mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
updates to viewer
This commit is contained in:
parent
1a1e2c20c0
commit
1239b22c30
@ -62,7 +62,7 @@ class CanvasDrawer extends $.DrawerBase{
|
||||
this.sketchContext = null;
|
||||
|
||||
// Image smoothing for canvas rendering (only if canvas is used).
|
||||
// Canvas default is "true", so this will only be changed if user specifies "false" in setImageSmoothinEnabled.
|
||||
// Canvas default is "true", so this will only be changed if user specifies "false" in the options or via setImageSmoothinEnabled.
|
||||
this._imageSmoothingEnabled = true;
|
||||
|
||||
}
|
||||
@ -138,7 +138,7 @@ class CanvasDrawer extends $.DrawerBase{
|
||||
* {@link OpenSeadragon.Options} for more explanation.
|
||||
*/
|
||||
setImageSmoothingEnabled(imageSmoothingEnabled){
|
||||
this._imageSmoothingEnabled = imageSmoothingEnabled;
|
||||
this._imageSmoothingEnabled = !!imageSmoothingEnabled;
|
||||
this._updateImageSmoothingEnabled(this.context);
|
||||
this.viewer.forceRedraw();
|
||||
}
|
||||
|
@ -447,6 +447,8 @@ $.Viewer = function( options ) {
|
||||
}
|
||||
let drawerCandidates = Array.isArray(this.drawer) ? this.drawer : [this.drawer];
|
||||
if (drawerCandidates.length === 0){
|
||||
// if an empty array was passed in, throw a warning and use the defaults
|
||||
// note: if the drawer option is not specified, the defaults will already be set so this won't apply
|
||||
drawerCandidates = [$.DEFAULT_SETTINGS.drawer].flat(); // ensure it is a list
|
||||
$.console.warn('No valid drawers were selected. Using the default value.');
|
||||
}
|
||||
@ -487,13 +489,15 @@ $.Viewer = function( options ) {
|
||||
throw('Error with creating the selected drawer(s)');
|
||||
}
|
||||
|
||||
// Pass the imageSmoothingEnabled option along to the drawer
|
||||
this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled);
|
||||
|
||||
// Overlay container
|
||||
this.overlaysContainer = $.makeNeutralElement( "div" );
|
||||
this.canvas.appendChild( this.overlaysContainer );
|
||||
|
||||
// Now that we have a drawer, see if it supports rotate. If not we need to remove the rotate buttons
|
||||
if (this.drawer && !this.drawer.canRotate()) {
|
||||
if (!this.drawer.canRotate()) {
|
||||
// Disable/remove the rotate left/right buttons since they aren't supported
|
||||
if (this.rotateLeft) {
|
||||
i = this.buttonGroup.buttons.indexOf(this.rotateLeft);
|
||||
|
@ -392,8 +392,10 @@
|
||||
* @param {Boolean} enabled
|
||||
*/
|
||||
setImageSmoothingEnabled(enabled){
|
||||
this._clippingContext.imageSmoothingEnabled = enabled;
|
||||
this._outputContext.imageSmoothingEnabled = enabled;
|
||||
//TODO: does imageSmoothingEnabled make sense in the WebGL drawer?
|
||||
// We aren't scaling small images up to larger ones using context2d canvas operations so it may not apply
|
||||
this._clippingContext.imageSmoothingEnabled = !!enabled;
|
||||
this._outputContext.imageSmoothingEnabled = !!enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user