]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Avoid fractional pixel sizes from Display
authorPierre Ossman <ossman@cendio.se>
Thu, 11 Jun 2020 14:31:09 +0000 (16:31 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 11 Jun 2020 14:50:08 +0000 (16:50 +0200)
core/display.js

index 7b7f5363ea109902d0548b33ad5d91b6f1d902dd..cf1a51aaaebe607fd2685d87c3273636dd21ddcc 100644 (file)
@@ -9,6 +9,7 @@
 import * as Log from './util/logging.js';
 import Base64 from "./base64.js";
 import { supportsImageMetadata } from './util/browser.js';
+import { toSigned32bit } from './util/int.js';
 
 export default class Display {
     constructor(target) {
@@ -190,14 +191,14 @@ export default class Display {
         if (this._scale === 0) {
             return 0;
         }
-        return x / this._scale + this._viewportLoc.x;
+        return toSigned32bit(x / this._scale + this._viewportLoc.x);
     }
 
     absY(y) {
         if (this._scale === 0) {
             return 0;
         }
-        return y / this._scale + this._viewportLoc.y;
+        return toSigned32bit(y / this._scale + this._viewportLoc.y);
     }
 
     resize(width, height) {