mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +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;
|
this.sketchContext = null;
|
||||||
|
|
||||||
// Image smoothing for canvas rendering (only if canvas is used).
|
// 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;
|
this._imageSmoothingEnabled = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ class CanvasDrawer extends $.DrawerBase{
|
|||||||
* {@link OpenSeadragon.Options} for more explanation.
|
* {@link OpenSeadragon.Options} for more explanation.
|
||||||
*/
|
*/
|
||||||
setImageSmoothingEnabled(imageSmoothingEnabled){
|
setImageSmoothingEnabled(imageSmoothingEnabled){
|
||||||
this._imageSmoothingEnabled = imageSmoothingEnabled;
|
this._imageSmoothingEnabled = !!imageSmoothingEnabled;
|
||||||
this._updateImageSmoothingEnabled(this.context);
|
this._updateImageSmoothingEnabled(this.context);
|
||||||
this.viewer.forceRedraw();
|
this.viewer.forceRedraw();
|
||||||
}
|
}
|
||||||
|
@ -447,6 +447,8 @@ $.Viewer = function( options ) {
|
|||||||
}
|
}
|
||||||
let drawerCandidates = Array.isArray(this.drawer) ? this.drawer : [this.drawer];
|
let drawerCandidates = Array.isArray(this.drawer) ? this.drawer : [this.drawer];
|
||||||
if (drawerCandidates.length === 0){
|
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
|
drawerCandidates = [$.DEFAULT_SETTINGS.drawer].flat(); // ensure it is a list
|
||||||
$.console.warn('No valid drawers were selected. Using the default value.');
|
$.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)');
|
throw('Error with creating the selected drawer(s)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pass the imageSmoothingEnabled option along to the drawer
|
||||||
|
this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled);
|
||||||
|
|
||||||
// Overlay container
|
// Overlay container
|
||||||
this.overlaysContainer = $.makeNeutralElement( "div" );
|
this.overlaysContainer = $.makeNeutralElement( "div" );
|
||||||
this.canvas.appendChild( this.overlaysContainer );
|
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
|
// 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
|
// Disable/remove the rotate left/right buttons since they aren't supported
|
||||||
if (this.rotateLeft) {
|
if (this.rotateLeft) {
|
||||||
i = this.buttonGroup.buttons.indexOf(this.rotateLeft);
|
i = this.buttonGroup.buttons.indexOf(this.rotateLeft);
|
||||||
|
@ -392,8 +392,10 @@
|
|||||||
* @param {Boolean} enabled
|
* @param {Boolean} enabled
|
||||||
*/
|
*/
|
||||||
setImageSmoothingEnabled(enabled){
|
setImageSmoothingEnabled(enabled){
|
||||||
this._clippingContext.imageSmoothingEnabled = enabled;
|
//TODO: does imageSmoothingEnabled make sense in the WebGL drawer?
|
||||||
this._outputContext.imageSmoothingEnabled = enabled;
|
// 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