Skip to content

Commit

Permalink
fix: Use correct window to get the devicePixelRatio (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
ling1726 committed Mar 24, 2023
1 parent 2893e9a commit 5029579
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/modifiers/computeStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const unsetSides = {
// Round the offsets to the nearest suitable subpixel based on the DPR.
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
function roundOffsetsByDPR({ x, y }): Offsets {
const win: Window = window;
function roundOffsetsByDPR({ x, y }, win: Window): Offsets {
const dpr = win.devicePixelRatio || 1;

return {
Expand Down Expand Up @@ -150,7 +149,7 @@ export function mapToStyles({

({ x, y } =
roundOffsets === true
? roundOffsetsByDPR({ x, y })
? roundOffsetsByDPR({ x, y }, getWindow(popper))
: { x, y });

if (gpuAcceleration) {
Expand Down

0 comments on commit 5029579

Please sign in to comment.