diff --git a/LICENSE.txt b/LICENSE.txt index 7c6df831..247d11af 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ Copyright (C) 2009 CodePlex Foundation -Copyright (C) 2010-2023 OpenSeadragon contributors +Copyright (C) 2010-2024 OpenSeadragon contributors Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/src/button.js b/src/button.js index e6c525d7..34d1f27a 100644 --- a/src/button.js +++ b/src/button.js @@ -2,7 +2,7 @@ * OpenSeadragon - Button * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/buttongroup.js b/src/buttongroup.js index 6cab6395..8a1b4c9e 100644 --- a/src/buttongroup.js +++ b/src/buttongroup.js @@ -2,7 +2,7 @@ * OpenSeadragon - ButtonGroup * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/canvasdrawer.js b/src/canvasdrawer.js index 17c056ca..22d21c78 100644 --- a/src/canvasdrawer.js +++ b/src/canvasdrawer.js @@ -2,7 +2,7 @@ * OpenSeadragon - CanvasDrawer * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2022 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -347,7 +347,7 @@ class CanvasDrawer extends $.DrawerBase{ var point = tiledImage .imageToViewportCoordinates(coord.x, coord.y, true) .rotate(-tiledImage.getRotation(true), tiledImage._getRotationPoint(true)); - var clipPoint = self._viewportCoordToDrawerCoord(point); + var clipPoint = self.viewportCoordToDrawerCoord(point); if (sketchScale) { clipPoint = clipPoint.times(sketchScale); } @@ -500,23 +500,6 @@ class CanvasDrawer extends $.DrawerBase{ } } - /** - * This function converts the given point from to the drawer coordinate by - * multiplying it with the pixel density. - * This function does not take rotation into account, thus assuming provided - * point is at 0 degree. - * @private - * @param {OpenSeadragon.Point} point - the pixel point to convert - * @returns {OpenSeadragon.Point} Point in drawer coordinate system. - */ - _viewportCoordToDrawerCoord(point) { - var vpPoint = this.viewport.pixelFromPointNoRotate(point, true); - return new $.Point( - vpPoint.x * $.pixelDensityRatio, - vpPoint.y * $.pixelDensityRatio - ); - } - /** * Draws special debug information for a TiledImage if in debug mode. * @private diff --git a/src/control.js b/src/control.js index 3cba9943..51fe020a 100644 --- a/src/control.js +++ b/src/control.js @@ -2,7 +2,7 @@ * OpenSeadragon - Control * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/controldock.js b/src/controldock.js index 0ab9e5cc..31f44b52 100644 --- a/src/controldock.js +++ b/src/controldock.js @@ -2,7 +2,7 @@ * OpenSeadragon - ControlDock * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/displayrectangle.js b/src/displayrectangle.js index 58610058..3c3284d5 100644 --- a/src/displayrectangle.js +++ b/src/displayrectangle.js @@ -2,7 +2,7 @@ * OpenSeadragon - DisplayRect * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/drawerbase.js b/src/drawerbase.js index 0b7c3b9f..e7574d25 100644 --- a/src/drawerbase.js +++ b/src/drawerbase.js @@ -2,7 +2,7 @@ * OpenSeadragon - DrawerBase * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,16 +34,6 @@ (function( $ ){ -$.DrawerOptions = class DrawerOptions{ - constructor(options){} -}; - -/** - * @typedef {Object} Point - * @property {number} x - * @property {number} y - */ - /** * @class DrawerBase * @memberof OpenSeadragon @@ -90,16 +80,14 @@ $.DrawerBase = class DrawerBase{ */ this.container = $.getElement( options.element ); - // We force our container to ltr because our drawing math doesn't work in rtl. - // This issue only affects our canvas renderer, but we do it always for consistency. - // Note that this means overlays you want to be rtl need to be explicitly set to rtl. - this.container.dir = 'ltr'; + this._renderingTarget = this._createDrawingElement(); + - // the first time this.canvas is accessed, implementations will create it this.canvas.style.width = "100%"; this.canvas.style.height = "100%"; this.canvas.style.position = "absolute"; - $.setElementOpacity( this.canvas, this.viewer.opacity, true ); // set + this.canvas.style.left = "0"; + $.setElementOpacity( this.canvas, this.viewer.opacity, true ); // Allow pointer events to pass through the canvas element so implicit // pointer capture works on touch devices @@ -113,10 +101,8 @@ $.DrawerBase = class DrawerBase{ this._checkForAPIOverrides(); } + // protect the canvas member with a getter get canvas(){ - if(!this._renderingTarget){ - this._renderingTarget = this._createDrawingElement(); - } return this._renderingTarget; } get element(){ @@ -125,9 +111,10 @@ $.DrawerBase = class DrawerBase{ } /** - * @property {String|undefined} type What type of drawer this is. Implementations should override this property. + * @returns {String|undefined} What type of drawer this is. */ getType(){ + $.console.error('Drawer.getType must be implemented by child class'); return undefined; } @@ -206,26 +193,25 @@ $.DrawerBase = class DrawerBase{ /** * @private - * @inner * Ensures that child classes have provided implementations for public API methods * draw, canRotate, destroy, and setImageSmoothinEnabled. Throws an exception if the original * placeholder methods are still in place. */ _checkForAPIOverrides(){ if(this._createDrawingElement === $.DrawerBase.prototype._createDrawingElement){ - throw("[drawer]._createDrawingElement must be implemented by child class"); + throw(new Error("[drawer]._createDrawingElement must be implemented by child class")); } if(this.draw === $.DrawerBase.prototype.draw){ - throw("[drawer].draw must be implemented by child class"); + throw(new Error("[drawer].draw must be implemented by child class")); } if(this.canRotate === $.DrawerBase.prototype.canRotate){ - throw("[drawer].canRotate must be implemented by child class"); + throw(new Error("[drawer].canRotate must be implemented by child class")); } if(this.destroy === $.DrawerBase.prototype.destroy){ - throw("[drawer].destroy must be implemented by child class"); + throw(new Error("[drawer].destroy must be implemented by child class")); } if(this.setImageSmoothingEnabled === $.DrawerBase.prototype.setImageSmoothingEnabled){ - throw("[drawer].setImageSmoothingEnabled must be implemented by child class"); + throw(new Error("[drawer].setImageSmoothingEnabled must be implemented by child class")); } } @@ -271,19 +257,14 @@ $.DrawerBase = class DrawerBase{ /** * @private - * @inner * Calculate width and height of the canvas based on viewport dimensions * and pixelDensityRatio - * @returns {Point} {x, y} size of the canvas + * @returns {OpenSeadragon.Point} {x, y} size of the canvas */ _calculateCanvasSize() { var pixelDensityRatio = $.pixelDensityRatio; var viewportSize = this.viewport.getContainerSize(); - return { - // canvas width and height are integers - x: Math.round(viewportSize.x * pixelDensityRatio), - y: Math.round(viewportSize.y * pixelDensityRatio) - }; + return new OpenSeadragon.Point( Math.round(viewportSize.x * pixelDensityRatio), Math.round(viewportSize.y * pixelDensityRatio)); } }; diff --git a/src/dzitilesource.js b/src/dzitilesource.js index 57b9f5a3..5ee28bfc 100644 --- a/src/dzitilesource.js +++ b/src/dzitilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - DziTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/eventsource.js b/src/eventsource.js index 94949f0f..e696c0b2 100644 --- a/src/eventsource.js +++ b/src/eventsource.js @@ -2,7 +2,7 @@ * OpenSeadragon - EventSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/fullscreen.js b/src/fullscreen.js index 1b80464c..4af8630d 100644 --- a/src/fullscreen.js +++ b/src/fullscreen.js @@ -2,7 +2,7 @@ * OpenSeadragon - full-screen support functions * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/htmldrawer.js b/src/htmldrawer.js index 6c2ec102..22423bce 100644 --- a/src/htmldrawer.js +++ b/src/htmldrawer.js @@ -2,7 +2,7 @@ * OpenSeadragon - HTMLDrawer * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -130,7 +130,6 @@ class HTMLDrawer extends $.DrawerBase{ /** * @private - * @inner * Clears the Drawer so it's ready to draw another frame. * */ @@ -140,7 +139,6 @@ class HTMLDrawer extends $.DrawerBase{ /** * @private - * @inner * Draws a TiledImage. * */ @@ -179,7 +177,6 @@ class HTMLDrawer extends $.DrawerBase{ /** * @private - * @inner * Draws the given tile. * @param {OpenSeadragon.Tile} tile - The tile to draw. * @param {Function} drawingHandler - Method for firing the drawing event if using canvas. diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index 54ec073f..1433a968 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - IIIFTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/imageloader.js b/src/imageloader.js index e66bd820..50ccac65 100644 --- a/src/imageloader.js +++ b/src/imageloader.js @@ -2,7 +2,7 @@ * OpenSeadragon - ImageLoader * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/imagetilesource.js b/src/imagetilesource.js index b039cc2b..4ebc7591 100644 --- a/src/imagetilesource.js +++ b/src/imagetilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - ImageTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/legacytilesource.js b/src/legacytilesource.js index e80b931f..f500d728 100644 --- a/src/legacytilesource.js +++ b/src/legacytilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - LegacyTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/matrix.js b/src/matrix.js index 1f580658..59d57ab5 100644 --- a/src/matrix.js +++ b/src/matrix.js @@ -2,7 +2,7 @@ * OpenSeadragon - Mat3 * * Modified from https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html - * Copyright (C) 2010-2023 webglfundamentals.org and OpenSeadragon contributors + * Copyright (C) 2010-2024 webglfundamentals.org and OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/mousetracker.js b/src/mousetracker.js index 57d89d5b..7a381b7e 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -2,7 +2,7 @@ * OpenSeadragon - MouseTracker * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/navigator.js b/src/navigator.js index 21544b9a..6a213624 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -2,7 +2,7 @@ * OpenSeadragon - Navigator * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/openseadragon.js b/src/openseadragon.js index 3c05509e..bcff91d0 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2,7 +2,7 @@ * OpenSeadragon * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/osmtilesource.js b/src/osmtilesource.js index 43e525ab..4f9d1f35 100644 --- a/src/osmtilesource.js +++ b/src/osmtilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - OsmTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/overlay.js b/src/overlay.js index bc25a051..7dec6a6b 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -2,7 +2,7 @@ * OpenSeadragon - Overlay * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/placement.js b/src/placement.js index 561d5daf..2db3e2b1 100644 --- a/src/placement.js +++ b/src/placement.js @@ -1,7 +1,7 @@ /* * OpenSeadragon - Placement * - * Copyright (C) 2010-2016 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/point.js b/src/point.js index 8df11d63..cc831b26 100644 --- a/src/point.js +++ b/src/point.js @@ -2,7 +2,7 @@ * OpenSeadragon - Point * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/profiler.js b/src/profiler.js index d0ffc2b2..01566bc0 100644 --- a/src/profiler.js +++ b/src/profiler.js @@ -2,7 +2,7 @@ * OpenSeadragon - Profiler * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/rectangle.js b/src/rectangle.js index fdeab18f..d154691d 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -2,7 +2,7 @@ * OpenSeadragon - Rect * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/referencestrip.js b/src/referencestrip.js index ee516c6f..9e15852d 100644 --- a/src/referencestrip.js +++ b/src/referencestrip.js @@ -2,7 +2,7 @@ * OpenSeadragon - ReferenceStrip * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/spring.js b/src/spring.js index a431d56f..f65f076e 100644 --- a/src/spring.js +++ b/src/spring.js @@ -2,7 +2,7 @@ * OpenSeadragon - Spring * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/strings.js b/src/strings.js index e423bef9..9d2b30d7 100644 --- a/src/strings.js +++ b/src/strings.js @@ -2,7 +2,7 @@ * OpenSeadragon - getString/setString * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tile.js b/src/tile.js index 8edcc605..0b6d5fb2 100644 --- a/src/tile.js +++ b/src/tile.js @@ -2,7 +2,7 @@ * OpenSeadragon - Tile * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tilecache.js b/src/tilecache.js index c776a077..f85cb643 100644 --- a/src/tilecache.js +++ b/src/tilecache.js @@ -2,7 +2,7 @@ * OpenSeadragon - TileCache * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tiledimage.js b/src/tiledimage.js index 98a92e24..16f04f76 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -2,7 +2,7 @@ * OpenSeadragon - TiledImage * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tilesource.js b/src/tilesource.js index 4961a47f..73e3536d 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - TileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tilesourcecollection.js b/src/tilesourcecollection.js index e1483184..29d7ec94 100644 --- a/src/tilesourcecollection.js +++ b/src/tilesourcecollection.js @@ -2,7 +2,7 @@ * OpenSeadragon - TileSourceCollection * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/tmstilesource.js b/src/tmstilesource.js index b6deeb03..5f8c999f 100644 --- a/src/tmstilesource.js +++ b/src/tmstilesource.js @@ -2,7 +2,7 @@ * OpenSeadragon - TmsTileSource * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/viewer.js b/src/viewer.js index 45da8ec7..f60fcffa 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2,7 +2,7 @@ * OpenSeadragon - Viewer * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/viewport.js b/src/viewport.js index 02e173f0..3bd51ac8 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -2,7 +2,7 @@ * OpenSeadragon - Viewport * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/webgldrawer.js b/src/webgldrawer.js index e0ca0314..fc24e4ef 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -3,7 +3,7 @@ * OpenSeadragon - WebGLDrawer * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -875,7 +875,6 @@ this._clippingContext.clip(); } _renderToClippingCanvas(item){ - let _this = this; this._clippingContext.clearRect(0, 0, this._clippingCanvas.width, this._clippingCanvas.height); this._clippingContext.save(); @@ -886,18 +885,18 @@ this._setClip(rect); } if(item._croppingPolygons){ - let polygons = item._croppingPolygons.map(function (polygon) { - return polygon.map(function (coord) { + let polygons = item._croppingPolygons.map(polygon => { + return polygon.map(coord => { 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); + .rotate(this.viewer.viewport.getRotation(true), this.viewer.viewport.getCenter(true)); + let clipPoint = this.viewportCoordToDrawerCoord(point); return clipPoint; }); }); this._clippingContext.beginPath(); - polygons.forEach(function (polygon) { - polygon.forEach(function (coord, i) { - _this._clippingContext[i === 0 ? 'moveTo' : 'lineTo'](coord.x, coord.y); + polygons.forEach(polygon => { + polygon.forEach( (coord, i) => { + this._clippingContext[i === 0 ? 'moveTo' : 'lineTo'](coord.x, coord.y); }); }); this._clippingContext.clip(); @@ -927,25 +926,6 @@ context.translate(-point.x, -point.y); } - - /** - * @private - * @inner - * This function converts the given point from to the drawer coordinate by - * multiplying it with the pixel density. - * This function does not take rotation into account, thus assuming provided - * point is at 0 degree. - * @param {OpenSeadragon.Point} point - the pixel point to convert - * @returns {OpenSeadragon.Point} Point in drawer coordinate system. - */ - _viewportCoordToDrawerCoord(point) { - var vpPoint = this.viewport.pixelFromPointNoRotate(point, true); - return new $.Point( - vpPoint.x * $.pixelDensityRatio, - vpPoint.y * $.pixelDensityRatio - ); - } - // private _drawDebugInfo( tilesToDraw, tiledImage, stroke, fill ) { diff --git a/src/world.js b/src/world.js index ef24d399..5539d2bc 100644 --- a/src/world.js +++ b/src/world.js @@ -2,7 +2,7 @@ * OpenSeadragon - World * * Copyright (C) 2009 CodePlex Foundation - * Copyright (C) 2010-2023 OpenSeadragon contributors + * Copyright (C) 2010-2024 OpenSeadragon contributors * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are