Compare commits

...

3 Commits

Author SHA1 Message Date
Ian Gilman
bdb44d84fb Changelog for #2183 2022-07-26 14:58:07 -07:00
Ian Gilman
c449a8353d
Merge pull request #2183 from altert/master
Fix closure for croppingPolygons in _drawTiles function
2022-07-26 14:55:09 -07:00
altert
5829a9e892 fix closure for croppingPolygons in drawTile 2022-07-26 13:12:48 +05:30
2 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,7 @@ OPENSEADRAGON CHANGELOG
* You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf) * You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf)
* Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson) * Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson)
* We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa) * We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa)
* Fixed: Cropping tiled images with polygons was broken (#2183 @altert)
3.1.0: 3.1.0:

View File

@ -1940,14 +1940,15 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
} }
if (this._croppingPolygons) { if (this._croppingPolygons) {
var self = this;
this._drawer.saveContext(useSketch); this._drawer.saveContext(useSketch);
try { try {
var polygons = this._croppingPolygons.map(function (polygon) { var polygons = this._croppingPolygons.map(function (polygon) {
return polygon.map(function (coord) { return polygon.map(function (coord) {
var point = this var point = self
.imageToViewportCoordinates(coord.x, coord.y, true) .imageToViewportCoordinates(coord.x, coord.y, true)
.rotate(-this.getRotation(true), this._getRotationPoint(true)); .rotate(-self.getRotation(true), self._getRotationPoint(true));
var clipPoint = this._drawer.viewportCoordToDrawerCoord(point); var clipPoint = self._drawer.viewportCoordToDrawerCoord(point);
if (sketchScale) { if (sketchScale) {
clipPoint = clipPoint.times(sketchScale); clipPoint = clipPoint.times(sketchScale);
} }