From 9616e26dd2a59cac291e816f74da1be1e9b177c4 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 15 Dec 2023 13:13:40 -0500 Subject: [PATCH] updates in drawers and tiled image --- src/canvasdrawer.js | 5 ++--- src/drawerbase.js | 18 +----------------- src/htmldrawer.js | 13 ++----------- src/tiledimage.js | 4 +--- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/canvasdrawer.js b/src/canvasdrawer.js index 22d21c78..49dd1047 100644 --- a/src/canvasdrawer.js +++ b/src/canvasdrawer.js @@ -46,9 +46,8 @@ */ class CanvasDrawer extends $.DrawerBase{ - constructor(){ - // pass through ...arguments to DrawerBase to support positional arguments (legacy, not preferred) - super(...arguments); + constructor(options){ + super(options); /** * 2d drawing context for {@link OpenSeadragon.CanvasDrawer#canvas}. diff --git a/src/drawerbase.js b/src/drawerbase.js index e7574d25..05c8e888 100644 --- a/src/drawerbase.js +++ b/src/drawerbase.js @@ -47,26 +47,9 @@ $.DrawerBase = class DrawerBase{ constructor(options){ $.console.assert( options.viewer, "[Drawer] options.viewer is required" ); - - //backward compatibility for positional args while preferring more - //idiomatic javascript options object as the only argument - var args = arguments; - - if( !$.isPlainObject( options ) ){ - options = { - source: args[ 0 ], // Reference to Viewer tile source. - viewport: args[ 1 ], // Reference to Viewer viewport. - element: args[ 2 ] // Parent element. - }; - } - $.console.assert( options.viewport, "[Drawer] options.viewport is required" ); $.console.assert( options.element, "[Drawer] options.element is required" ); - if ( options.source ) { - $.console.error( "[Drawer] options.source is no longer accepted; use TiledImage instead" ); - } - this.viewer = options.viewer; this.viewport = options.viewport; this.debugGridColor = typeof options.debugGridColor === 'string' ? [options.debugGridColor] : options.debugGridColor || $.DEFAULT_SETTINGS.debugGridColor; @@ -86,6 +69,7 @@ $.DrawerBase = class DrawerBase{ this.canvas.style.width = "100%"; this.canvas.style.height = "100%"; this.canvas.style.position = "absolute"; + // set canvas.style.left = 0 so the canvas is positioned properly in ltr and rtl html this.canvas.style.left = "0"; $.setElementOpacity( this.canvas, this.viewer.opacity, true ); diff --git a/src/htmldrawer.js b/src/htmldrawer.js index 22423bce..342e157f 100644 --- a/src/htmldrawer.js +++ b/src/htmldrawer.js @@ -46,17 +46,8 @@ */ class HTMLDrawer extends $.DrawerBase{ - constructor(){ - // pass through ...arguments to DrawerBase to support positional arguments (legacy, not preferred) - super(...arguments); - - /** - * 2d drawing context for {@link OpenSeadragon.Drawer#canvas} if it's a <canvas> element, otherwise null. - * @member {Object} context - * @memberof OpenSeadragon.Drawer# - */ - this.context = null; - + constructor(options){ + super(options); } /** diff --git a/src/tiledimage.js b/src/tiledimage.js index 7c96e78f..c226c08a 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1710,9 +1710,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag x, y, level, currentTime, - numberOfTiles, - this._worldWidthCurrent, - this._worldHeightCurrent + numberOfTiles ), drawTile = drawLevel;