From 5eece7d73a812e8884921a0b94c2669a3014f113 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 6 Mar 2023 14:29:39 -0500 Subject: [PATCH] fix cropping when viewer is rotated --- test/demo/threejsdrawer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/demo/threejsdrawer.js b/test/demo/threejsdrawer.js index feaf0a91..32719110 100644 --- a/test/demo/threejsdrawer.js +++ b/test/demo/threejsdrawer.js @@ -484,7 +484,8 @@ export class ThreeJSDrawer extends OpenSeadragon.DrawerBase{ if(item._croppingPolygons){ let polygons = item._croppingPolygons.map(function (polygon) { return polygon.map(function (coord) { - let point = item.imageToViewportCoordinates(coord.x, coord.y, true); + let point = item.imageToViewportCoordinates(coord.x, coord.y, true) + .rotate(_this.viewer.viewport.getRotation(true), _this.viewer.viewport.getCenter(true)); let clipPoint = _this.viewportCoordToDrawerCoord(point); return clipPoint; });