From 5829a9e89293e111927ec9ed494f8960c500d22d Mon Sep 17 00:00:00 2001 From: altert Date: Tue, 26 Jul 2022 13:12:48 +0530 Subject: [PATCH] fix closure for croppingPolygons in drawTile --- src/tiledimage.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index e768d852..3f83c8de 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1940,14 +1940,15 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag } if (this._croppingPolygons) { + var self = this; this._drawer.saveContext(useSketch); try { var polygons = this._croppingPolygons.map(function (polygon) { return polygon.map(function (coord) { - var point = this + var point = self .imageToViewportCoordinates(coord.x, coord.y, true) - .rotate(-this.getRotation(true), this._getRotationPoint(true)); - var clipPoint = this._drawer.viewportCoordToDrawerCoord(point); + .rotate(-self.getRotation(true), self._getRotationPoint(true)); + var clipPoint = self._drawer.viewportCoordToDrawerCoord(point); if (sketchScale) { clipPoint = clipPoint.times(sketchScale); }