From fab607584c677a709184489e8bc7ba0e9f2aea3d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 25 Oct 2024 11:15:52 -0600 Subject: [PATCH] fix problem with asymmetric viewport margins --- src/webgldrawer.js | 5 +++-- test/demo/drawercomparison.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index a102ce31..0489eecb 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -255,9 +255,10 @@ */ draw(tiledImages){ let gl = this._gl; + const bounds = this.viewport.getBoundsNoRotateWithMargins(true); let view = { - bounds: this.viewport.getBoundsNoRotateWithMargins(true), - center: this.viewport.getCenter(true), + bounds: bounds, + center: new OpenSeadragon.Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2), rotation: this.viewport.getRotation(true) * Math.PI / 180 }; diff --git a/test/demo/drawercomparison.js b/test/demo/drawercomparison.js index 9b1bf6a7..bb96219b 100644 --- a/test/demo/drawercomparison.js +++ b/test/demo/drawercomparison.js @@ -19,10 +19,10 @@ const drawers = { } const viewportMargins = { - left: 25, - top: 25, - right: 25, - bottom: 25, + left: 100, + top: 0, + right: 0, + bottom: 50, }; //Support drawer type from the url