From 97b86abc948f3f1d5d20864bb4325a0feb6f34bb Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 11 Jun 2020 16:31:09 +0200 Subject: [PATCH] Avoid fractional pixel sizes from Display --- core/display.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/display.js b/core/display.js index 7b7f5363..cf1a51aa 100644 --- a/core/display.js +++ b/core/display.js @@ -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) {