Fixing screen sizing issue at certain resolutions (#144)

* Updating recalculate primary display container size to ensure it is an even resolution

* updaing to get parent node size including subpixel value

* updating comment for clarity
This commit is contained in:
rspruel 2025-07-07 12:32:18 -04:00 committed by GitHub
parent 31cf849134
commit ada6d16704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -263,12 +263,15 @@ export default class Display {
let i = 0;
//getting parent node size with sub-pixel precision
let parentNodeSize = this._target.parentNode.getBoundingClientRect();
//recalculate primary display container size
this._screens[i].containerHeight = this._target.parentNode.offsetHeight;
this._screens[i].containerWidth = this._target.parentNode.offsetWidth;
this._screens[i].containerHeight = Math.floor(parentNodeSize.height / 2) * 2;
this._screens[i].containerWidth = Math.floor(parentNodeSize.width / 2) * 2;
this._screens[i].pixelRatio = window.devicePixelRatio;
this._screens[i].width = this._target.parentNode.offsetWidth;
this._screens[i].height = this._target.parentNode.offsetHeight;
this._screens[i].width = this._screens[i].containerWidth;
this._screens[i].height = this._screens[i].containerHeight;
//calculate server-side and client-side resolution of each screen
let width = max_width || this._screens[i].containerWidth;