Skip to content

Commit

Permalink
fix the return of odd numbered pixels
Browse files Browse the repository at this point in the history
The point of subtracting a dimension%2 from its actual dimension is to
avoid odd numbered pixels, so due to variation of DPR from device to
device the subtraction should be done at the end of pixel calculation.
  • Loading branch information
PMohanJ committed Dec 24, 2023
1 parent 2498ecc commit 3556058
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/gst-web/src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ class Input {

getWindowResolution() {
return [
parseInt((document.body.offsetWidth - document.body.offsetWidth%2) * window.devicePixelRatio),
parseInt((document.body.offsetHeight - document.body.offsetHeight%2) * window.devicePixelRatio)
parseInt( (() => {var width = document.body.offsetWidth * window.devicePixelRatio; return width - width % 2})() ),
parseInt( (() => {var height = document.body.offsetHeight * window.devicePixelRatio; return height - height % 2})() )
];
}
}
Expand Down

0 comments on commit 3556058

Please sign in to comment.