Merge remote-tracking branch 'upstream/master' into mousebuttons479

Conflicts:
	changelog.txt
This commit is contained in:
Mark Salsbery 2015-01-12 15:36:19 -08:00
commit e4c549927b
4 changed files with 39 additions and 9 deletions

View File

@ -3,6 +3,8 @@ OPENSEADRAGON CHANGELOG
1.2.1: (in progress)
* Added preserveOverlays option (#561)
* Fixed: DZI tilesource was broken (#563)
* Exposed secondary pointer button (middle, right, etc.) events from MouseTracker and through viewer (#479)
* MouseTracker - Improved IE 8 compatibility (#562)

View File

@ -107,9 +107,11 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
var ns;
if ( data.Image ) {
ns = data.Image.xmlns;
} else if ( data.documentElement && "Image" == data.documentElement.localName ) {
} else if ( data.documentElement) {
if ("Image" == data.documentElement.localName || "Image" == data.documentElement.tagName) {
ns = data.documentElement.namespaceURI;
}
}
return ( "http://schemas.microsoft.com/deepzoom/2008" == ns ||
"http://schemas.microsoft.com/deepzoom/2009" == ns );
@ -221,7 +223,7 @@ function configureFromXML( tileSource, xmlDoc ){
}
var root = xmlDoc.documentElement,
rootName = root.localName,
rootName = root.localName || root.tagName,
ns = xmlDoc.documentElement.namespaceURI,
configuration = null,
displayRects = [],
@ -234,7 +236,10 @@ function configureFromXML( tileSource, xmlDoc ){
if ( rootName == "Image" ) {
try {
sizeNode = root.getElementsByTagName("Size" )[ 0 ];
if (sizeNode === undefined) {
sizeNode = root.getElementsByTagNameNS(ns, "Size" )[ 0 ];
}
configuration = {
Image: {
@ -257,11 +262,17 @@ function configureFromXML( tileSource, xmlDoc ){
);
}
dispRectNodes = root.getElementsByTagNameNS(ns, "DisplayRect" );
dispRectNodes = root.getElementsByTagName("DisplayRect" );
if (dispRectNodes === undefined) {
dispRectNodes = root.getElementsByTagNameNS(ns, "DisplayRect" )[ 0 ];
}
for ( i = 0; i < dispRectNodes.length; i++ ) {
dispRectNode = dispRectNodes[ i ];
rectNode = dispRectNode.getElementsByTagName("Rect" )[ 0 ];
if (rectNode === undefined) {
rectNode = dispRectNode.getElementsByTagNameNS(ns, "Rect" )[ 0 ];
}
displayRects.push({
Rect: {

View File

@ -515,10 +515,18 @@
*
* @property {Boolean} [preserveViewport=false]
* If the viewer has been configured with a sequence of tile sources, then
* normally navigating to through each image resets the viewport to 'home'
* normally navigating through each image resets the viewport to 'home'
* 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 through each image resets the overlays.
* If preserveOverlays is set to true, then the overlays
* are preserved when navigating between images in the sequence.
* Note: setting preserveOverlays overrides any overlays specified in the
* "overlays" property.
*
* @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 +953,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

@ -541,9 +541,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();
@ -1970,6 +1974,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({