mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Navigator now works with multiple images
This commit is contained in:
parent
63996a7d92
commit
e02209092c
@ -216,15 +216,19 @@ $.Navigator = function( options ){
|
||||
unneededElement.parentNode.removeChild(unneededElement);
|
||||
}
|
||||
|
||||
if (options.navigatorRotate)
|
||||
{
|
||||
if (options.navigatorRotate) {
|
||||
options.viewer.addHandler("rotate", function (args) {
|
||||
_setTransformRotate(_this.displayRegionContainer, args.degrees);
|
||||
_setTransformRotate(_this.displayRegion, -args.degrees);
|
||||
_this.viewport.setRotation(args.degrees);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.addHandler("reset-size", function() {
|
||||
if (_this.viewport) {
|
||||
_this.viewport.goHome(true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /** @lends OpenSeadragon.Navigator.prototype */{
|
||||
@ -313,7 +317,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
|
||||
},
|
||||
|
||||
open: function( source ) {
|
||||
open: function(source, options) {
|
||||
this.updateSize();
|
||||
var containerSize = this.viewer.viewport.containerSize.times( this.sizeRatio );
|
||||
var ts = source.getTileSize(source.maxLevel);
|
||||
@ -322,7 +326,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
} else {
|
||||
this.minPixelRatio = this.viewer.minPixelRatio;
|
||||
}
|
||||
return $.Viewer.prototype.open.apply( this, [ source ] );
|
||||
return $.Viewer.prototype.open.apply( this, [source, options] );
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -1112,6 +1112,14 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
_this.world.addItem( tiledImage, {
|
||||
index: options.index
|
||||
});
|
||||
|
||||
if (_this.navigator) {
|
||||
var optionsClone = $.extend({}, options, {
|
||||
tileSource: tileSource
|
||||
});
|
||||
|
||||
_this.navigator.addTiledImage(optionsClone);
|
||||
}
|
||||
}, function( event ) {
|
||||
event.options = options;
|
||||
raiseAddItemFailed(event);
|
||||
@ -1956,9 +1964,7 @@ function openTileSource( viewer, source, options ) {
|
||||
if ( _this.showNavigator && !_this.collectionMode ){
|
||||
// Note: By passing the fully parsed source, the navigator doesn't
|
||||
// have to load it again.
|
||||
if ( _this.navigator ) {
|
||||
_this.navigator.open( source );
|
||||
} else {
|
||||
if (!_this.navigator) {
|
||||
_this.navigator = new $.Navigator({
|
||||
id: _this.navigatorId,
|
||||
position: _this.navigatorPosition,
|
||||
@ -1969,13 +1975,14 @@ function openTileSource( viewer, source, options ) {
|
||||
width: _this.navigatorWidth,
|
||||
height: _this.navigatorHeight,
|
||||
autoResize: _this.navigatorAutoResize,
|
||||
tileSources: source,
|
||||
tileHost: _this.tileHost,
|
||||
prefixUrl: _this.prefixUrl,
|
||||
viewer: _this,
|
||||
navigatorRotate: _this.navigatorRotate
|
||||
});
|
||||
}
|
||||
|
||||
_this.navigator.open(source, options);
|
||||
}
|
||||
|
||||
//Instantiate a referencestrip if configured
|
||||
|
@ -9,7 +9,7 @@
|
||||
this.viewer = OpenSeadragon( {
|
||||
debugMode: true,
|
||||
zoomPerScroll: 1.02,
|
||||
// showNavigator: true,
|
||||
showNavigator: true,
|
||||
id: "contentDiv",
|
||||
prefixUrl: "../../../build/openseadragon/images/"
|
||||
} );
|
||||
@ -87,6 +87,15 @@
|
||||
y: 0,
|
||||
width: 1
|
||||
});
|
||||
},
|
||||
|
||||
// ----------
|
||||
bigTest: function() {
|
||||
this.viewer.open("../../data/testpattern.dzi", {
|
||||
x: -2,
|
||||
y: -2,
|
||||
width: 6
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user