mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Allow silencing multi-image warnings
This commit is contained in:
parent
2b6c8dd622
commit
322a22cb68
@ -163,6 +163,10 @@
|
|||||||
* The colors of grids in debug mode. Each tiled image's grid uses a consecutive color.
|
* The colors of grids in debug mode. Each tiled image's grid uses a consecutive color.
|
||||||
* If there are more tiled images than provided colors, the color vector is recycled.
|
* If there are more tiled images than provided colors, the color vector is recycled.
|
||||||
*
|
*
|
||||||
|
* @property {Boolean} [silenceMultiImageWarnings=false]
|
||||||
|
* Silences warnings when calling viewport coordinate functions with multi-image.
|
||||||
|
* Useful when you're overlaying multiple images on top of one another.
|
||||||
|
*
|
||||||
* @property {Number} [blendTime=0]
|
* @property {Number} [blendTime=0]
|
||||||
* Specifies the duration of animation as higher or lower level tiles are
|
* Specifies the duration of animation as higher or lower level tiles are
|
||||||
* replacing the existing tile.
|
* replacing the existing tile.
|
||||||
@ -1370,7 +1374,9 @@ function OpenSeadragon( options ){
|
|||||||
|
|
||||||
//DEVELOPER SETTINGS
|
//DEVELOPER SETTINGS
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
debugGridColor: ['#437AB2', '#1B9E77', '#D95F02', '#7570B3', '#E7298A', '#66A61E', '#E6AB02', '#A6761D', '#666666']
|
debugGridColor: ['#437AB2', '#1B9E77', '#D95F02', '#7570B3', '#E7298A', '#66A61E', '#E6AB02', '#A6761D', '#666666'],
|
||||||
|
silenceMultiImageWarnings: false
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -366,23 +366,24 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
// Create the viewport
|
// Create the viewport
|
||||||
this.viewport = new $.Viewport({
|
this.viewport = new $.Viewport({
|
||||||
containerSize: THIS[ this.hash ].prevContainerSize,
|
containerSize: THIS[ this.hash ].prevContainerSize,
|
||||||
springStiffness: this.springStiffness,
|
springStiffness: this.springStiffness,
|
||||||
animationTime: this.animationTime,
|
animationTime: this.animationTime,
|
||||||
minZoomImageRatio: this.minZoomImageRatio,
|
minZoomImageRatio: this.minZoomImageRatio,
|
||||||
maxZoomPixelRatio: this.maxZoomPixelRatio,
|
maxZoomPixelRatio: this.maxZoomPixelRatio,
|
||||||
visibilityRatio: this.visibilityRatio,
|
visibilityRatio: this.visibilityRatio,
|
||||||
wrapHorizontal: this.wrapHorizontal,
|
wrapHorizontal: this.wrapHorizontal,
|
||||||
wrapVertical: this.wrapVertical,
|
wrapVertical: this.wrapVertical,
|
||||||
defaultZoomLevel: this.defaultZoomLevel,
|
defaultZoomLevel: this.defaultZoomLevel,
|
||||||
minZoomLevel: this.minZoomLevel,
|
minZoomLevel: this.minZoomLevel,
|
||||||
maxZoomLevel: this.maxZoomLevel,
|
maxZoomLevel: this.maxZoomLevel,
|
||||||
viewer: this,
|
viewer: this,
|
||||||
degrees: this.degrees,
|
degrees: this.degrees,
|
||||||
flipped: this.flipped,
|
flipped: this.flipped,
|
||||||
navigatorRotate: this.navigatorRotate,
|
navigatorRotate: this.navigatorRotate,
|
||||||
homeFillsViewer: this.homeFillsViewer,
|
homeFillsViewer: this.homeFillsViewer,
|
||||||
margins: this.viewportMargins
|
margins: this.viewportMargins,
|
||||||
|
silenceMultiImageWarnings: this.silenceMultiImageWarnings
|
||||||
});
|
});
|
||||||
|
|
||||||
this.viewport._setContentBounds(this.world.getHomeBounds(), this.world.getContentFactor());
|
this.viewport._setContentBounds(this.world.getHomeBounds(), this.world.getContentFactor());
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
* @param {Number} [options.maxZoomLevel] - See maxZoomLevel in {@link OpenSeadragon.Options}.
|
* @param {Number} [options.maxZoomLevel] - See maxZoomLevel in {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.degrees] - See degrees in {@link OpenSeadragon.Options}.
|
* @param {Number} [options.degrees] - See degrees in {@link OpenSeadragon.Options}.
|
||||||
* @param {Boolean} [options.homeFillsViewer] - See homeFillsViewer in {@link OpenSeadragon.Options}.
|
* @param {Boolean} [options.homeFillsViewer] - See homeFillsViewer in {@link OpenSeadragon.Options}.
|
||||||
|
* @param {Boolean} [options.silenceMultiImageWarnings] - See silenceMultiImageWarnings in {@link OpenSeadragon.Options}.
|
||||||
*/
|
*/
|
||||||
$.Viewport = function( options ) {
|
$.Viewport = function( options ) {
|
||||||
|
|
||||||
@ -96,19 +97,20 @@ $.Viewport = function( options ) {
|
|||||||
viewer: null,
|
viewer: null,
|
||||||
|
|
||||||
//configurable options
|
//configurable options
|
||||||
springStiffness: $.DEFAULT_SETTINGS.springStiffness,
|
springStiffness: $.DEFAULT_SETTINGS.springStiffness,
|
||||||
animationTime: $.DEFAULT_SETTINGS.animationTime,
|
animationTime: $.DEFAULT_SETTINGS.animationTime,
|
||||||
minZoomImageRatio: $.DEFAULT_SETTINGS.minZoomImageRatio,
|
minZoomImageRatio: $.DEFAULT_SETTINGS.minZoomImageRatio,
|
||||||
maxZoomPixelRatio: $.DEFAULT_SETTINGS.maxZoomPixelRatio,
|
maxZoomPixelRatio: $.DEFAULT_SETTINGS.maxZoomPixelRatio,
|
||||||
visibilityRatio: $.DEFAULT_SETTINGS.visibilityRatio,
|
visibilityRatio: $.DEFAULT_SETTINGS.visibilityRatio,
|
||||||
wrapHorizontal: $.DEFAULT_SETTINGS.wrapHorizontal,
|
wrapHorizontal: $.DEFAULT_SETTINGS.wrapHorizontal,
|
||||||
wrapVertical: $.DEFAULT_SETTINGS.wrapVertical,
|
wrapVertical: $.DEFAULT_SETTINGS.wrapVertical,
|
||||||
defaultZoomLevel: $.DEFAULT_SETTINGS.defaultZoomLevel,
|
defaultZoomLevel: $.DEFAULT_SETTINGS.defaultZoomLevel,
|
||||||
minZoomLevel: $.DEFAULT_SETTINGS.minZoomLevel,
|
minZoomLevel: $.DEFAULT_SETTINGS.minZoomLevel,
|
||||||
maxZoomLevel: $.DEFAULT_SETTINGS.maxZoomLevel,
|
maxZoomLevel: $.DEFAULT_SETTINGS.maxZoomLevel,
|
||||||
degrees: $.DEFAULT_SETTINGS.degrees,
|
degrees: $.DEFAULT_SETTINGS.degrees,
|
||||||
flipped: $.DEFAULT_SETTINGS.flipped,
|
flipped: $.DEFAULT_SETTINGS.flipped,
|
||||||
homeFillsViewer: $.DEFAULT_SETTINGS.homeFillsViewer
|
homeFillsViewer: $.DEFAULT_SETTINGS.homeFillsViewer,
|
||||||
|
silenceMultiImageWarnings: $.DEFAULT_SETTINGS.silenceMultiImageWarnings
|
||||||
|
|
||||||
}, options );
|
}, options );
|
||||||
|
|
||||||
@ -1170,8 +1172,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.viewportToImageCoordinates] is not accurate ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'with multi-image; use TiledImage.viewportToImageCoordinates instead.');
|
$.console.error('[Viewport.viewportToImageCoordinates] is not accurate ' +
|
||||||
|
'with multi-image; use TiledImage.viewportToImageCoordinates instead.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.viewportToImageCoordinates
|
// It is better to use TiledImage.viewportToImageCoordinates
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
@ -1214,8 +1218,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.imageToViewportCoordinates] is not accurate ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'with multi-image; use TiledImage.imageToViewportCoordinates instead.');
|
$.console.error('[Viewport.imageToViewportCoordinates] is not accurate ' +
|
||||||
|
'with multi-image; use TiledImage.imageToViewportCoordinates instead.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.viewportToImageCoordinates
|
// It is better to use TiledImage.viewportToImageCoordinates
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
@ -1256,8 +1262,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.imageToViewportRectangle] is not accurate ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'with multi-image; use TiledImage.imageToViewportRectangle instead.');
|
$.console.error('[Viewport.imageToViewportRectangle] is not accurate ' +
|
||||||
|
'with multi-image; use TiledImage.imageToViewportRectangle instead.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.imageToViewportRectangle
|
// It is better to use TiledImage.imageToViewportRectangle
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
@ -1304,8 +1312,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.viewportToImageRectangle] is not accurate ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'with multi-image; use TiledImage.viewportToImageRectangle instead.');
|
$.console.error('[Viewport.viewportToImageRectangle] is not accurate ' +
|
||||||
|
'with multi-image; use TiledImage.viewportToImageRectangle instead.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.viewportToImageCoordinates
|
// It is better to use TiledImage.viewportToImageCoordinates
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
@ -1469,8 +1479,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.viewportToImageZoom] is not ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'accurate with multi-image.');
|
$.console.error('[Viewport.viewportToImageZoom] is not ' +
|
||||||
|
'accurate with multi-image.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.viewportToImageZoom
|
// It is better to use TiledImage.viewportToImageZoom
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
@ -1503,8 +1515,10 @@ $.Viewport.prototype = {
|
|||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
var count = this.viewer.world.getItemCount();
|
var count = this.viewer.world.getItemCount();
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$.console.error('[Viewport.imageToViewportZoom] is not accurate ' +
|
if (!this.silenceMultiImageWarnings) {
|
||||||
'with multi-image.');
|
$.console.error('[Viewport.imageToViewportZoom] is not accurate ' +
|
||||||
|
'with multi-image.');
|
||||||
|
}
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// It is better to use TiledImage.imageToViewportZoom
|
// It is better to use TiledImage.imageToViewportZoom
|
||||||
// because this._contentBoundsNoRotate can not be relied on
|
// because this._contentBoundsNoRotate can not be relied on
|
||||||
|
Loading…
Reference in New Issue
Block a user