updates in drawers and tiled image

This commit is contained in:
Tom 2023-12-15 13:13:40 -05:00
parent 074b65bfcd
commit 9616e26dd2
4 changed files with 6 additions and 34 deletions

View File

@ -46,9 +46,8 @@
*/ */
class CanvasDrawer extends $.DrawerBase{ class CanvasDrawer extends $.DrawerBase{
constructor(){ constructor(options){
// pass through ...arguments to DrawerBase to support positional arguments (legacy, not preferred) super(options);
super(...arguments);
/** /**
* 2d drawing context for {@link OpenSeadragon.CanvasDrawer#canvas}. * 2d drawing context for {@link OpenSeadragon.CanvasDrawer#canvas}.

View File

@ -47,26 +47,9 @@
$.DrawerBase = class DrawerBase{ $.DrawerBase = class DrawerBase{
constructor(options){ constructor(options){
$.console.assert( options.viewer, "[Drawer] options.viewer is required" ); $.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.viewport, "[Drawer] options.viewport is required" );
$.console.assert( options.element, "[Drawer] options.element 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.viewer = options.viewer;
this.viewport = options.viewport; this.viewport = options.viewport;
this.debugGridColor = typeof options.debugGridColor === 'string' ? [options.debugGridColor] : options.debugGridColor || $.DEFAULT_SETTINGS.debugGridColor; 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.width = "100%";
this.canvas.style.height = "100%"; this.canvas.style.height = "100%";
this.canvas.style.position = "absolute"; 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"; this.canvas.style.left = "0";
$.setElementOpacity( this.canvas, this.viewer.opacity, true ); $.setElementOpacity( this.canvas, this.viewer.opacity, true );

View File

@ -46,17 +46,8 @@
*/ */
class HTMLDrawer extends $.DrawerBase{ class HTMLDrawer extends $.DrawerBase{
constructor(){ constructor(options){
// pass through ...arguments to DrawerBase to support positional arguments (legacy, not preferred) super(options);
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;
} }
/** /**

View File

@ -1710,9 +1710,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
x, y, x, y,
level, level,
currentTime, currentTime,
numberOfTiles, numberOfTiles
this._worldWidthCurrent,
this._worldHeightCurrent
), ),
drawTile = drawLevel; drawTile = drawLevel;