Merge pull request #561 from ShadOoW/master

Added preserveOverlays option to Viewer
This commit is contained in:
Ian Gilman 2015-01-12 09:53:17 -08:00
commit b9f2f95cee
2 changed files with 17 additions and 2 deletions

View File

@ -519,6 +519,12 @@
* position. If preserveViewport is set to true, then the viewport position
* is preserved when navigating between images in the sequence.
*
* @property {Boolean} [preserveOverlays=false]
* If the viewer has been configured with a sequence of tile sources, then
* normally navigating to through each image resets the overlays.
* If preserveOverlays is set to true, then the overlays
* are preserved when navigating between images in the sequence.
*
* @property {Boolean} [showReferenceStrip=false]
* If the viewer has been configured with a sequence of tile sources, then
* display a scrolling strip of image thumbnails for navigating through the images.
@ -945,6 +951,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
showSequenceControl: true, //SEQUENCE
sequenceControlAnchor: null, //SEQUENCE
preserveViewport: false, //SEQUENCE
preserveOverlays: false, //SEQUENCE
navPrevNextWrap: false, //SEQUENCE
showNavigationControl: true, //ZOOM/HOME/FULL/ROTATION
navigationControlAnchor: null, //ZOOM/HOME/FULL/ROTATION

View File

@ -539,9 +539,13 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.navigator.close();
}
if( ! this.preserveOverlays)
{
this.clearOverlays();
this.drawersContainer.innerHTML = "";
this.overlaysContainer.innerHTML = "";
}
this.drawersContainer.innerHTML = "";
if ( this.drawer ) {
this.drawer.destroy();
@ -1968,6 +1972,10 @@ function openTileSource( viewer, source ) {
_this.viewport.resetContentSize( _this.source.dimensions );
}
if( _this.preserveOverlays ){
_this.overlays = _this.currentOverlays;
}
_this.source.overlays = _this.source.overlays || [];
_this.drawer = new $.Drawer({