mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Moved Viewport.goHome to Viewer.goHome.
This commit is contained in:
parent
66b8d7e191
commit
5c7c1d5b6c
@ -333,7 +333,7 @@ $.Viewer = function( options ) {
|
|||||||
_this.viewport.applyConstraints();
|
_this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
case 48://0|)
|
case 48://0|)
|
||||||
_this.viewport.goHome();
|
_this.goHome();
|
||||||
_this.viewport.applyConstraints();
|
_this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
case 119://w
|
case 119://w
|
||||||
@ -622,6 +622,28 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
this.element = null;
|
this.element = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function
|
||||||
|
* @param {Boolean} immediately
|
||||||
|
* @fires OpenSeadragon.Viewer.event:home
|
||||||
|
*/
|
||||||
|
goHome: function(immediately) {
|
||||||
|
/**
|
||||||
|
* Raised when the "home" operation occurs (see {@link OpenSeadragon.Viewport#goHome}).
|
||||||
|
*
|
||||||
|
* @event home
|
||||||
|
* @memberof OpenSeadragon.Viewer
|
||||||
|
* @type {object}
|
||||||
|
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
||||||
|
* @property {Boolean} immediately
|
||||||
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
|
*/
|
||||||
|
this.raiseEvent( 'home', {
|
||||||
|
immediately: immediately
|
||||||
|
});
|
||||||
|
|
||||||
|
this.viewport.fitBounds( this.world.getHomeBounds(), immediately );
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
@ -1929,6 +1951,7 @@ function openTileSource( viewer, source, options ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
_this.world.addItem( tiledImage );
|
_this.world.addItem( tiledImage );
|
||||||
|
_this.goHome( true );
|
||||||
|
|
||||||
// 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.canRotate()) {
|
if (!_this.drawer.canRotate()) {
|
||||||
@ -2793,9 +2816,7 @@ function lightUp() {
|
|||||||
|
|
||||||
|
|
||||||
function onHome() {
|
function onHome() {
|
||||||
if ( this.viewport ) {
|
this.goHome();
|
||||||
this.viewport.goHome();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ $.Viewport = function( options ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.resetContentSize( this.contentSize );
|
this.resetContentSize( this.contentSize );
|
||||||
this.goHome( true );
|
|
||||||
this.update();
|
this.update();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -178,26 +177,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
* @param {Boolean} immediately
|
* @private
|
||||||
* @fires OpenSeadragon.Viewer.event:home
|
|
||||||
*/
|
*/
|
||||||
goHome: function( immediately ) {
|
goHome: function( immediately ) {
|
||||||
|
$.console.error("[Viewport.goHome] this function is deprecated; use Viewer.goHome instead");
|
||||||
if( this.viewer ){
|
if( this.viewer ){
|
||||||
/**
|
this.viewer.goHome(immediately);
|
||||||
* Raised when the "home" operation occurs (see {@link OpenSeadragon.Viewport#goHome}).
|
|
||||||
*
|
|
||||||
* @event home
|
|
||||||
* @memberof OpenSeadragon.Viewer
|
|
||||||
* @type {object}
|
|
||||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
|
||||||
* @property {Boolean} immediately
|
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
|
||||||
*/
|
|
||||||
this.viewer.raiseEvent( 'home', {
|
|
||||||
immediately: immediately
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return this.fitBounds( this.getHomeBounds(), immediately );
|
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('animation-finish', homeHandler);
|
viewer.addHandler('animation-finish', homeHandler);
|
||||||
viewport.goHome(true);
|
viewer.goHome(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.addHandler("open", opener);
|
viewer.addHandler("open", opener);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
var addLayerHandler = function( event ) {
|
var addLayerHandler = function( event ) {
|
||||||
if ( event.options === options ) {
|
if ( event.options === options ) {
|
||||||
self.viewer.removeHandler( "add-layer", addLayerHandler );
|
self.viewer.removeHandler( "add-layer", addLayerHandler );
|
||||||
|
self.viewer.goHome();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.viewer.addHandler( "add-layer", addLayerHandler );
|
this.viewer.addHandler( "add-layer", addLayerHandler );
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function goHome() {
|
function goHome() {
|
||||||
_viewer.viewport.goHome();
|
_viewer.goHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -270,7 +270,7 @@
|
|||||||
waitForViewer( function() {
|
waitForViewer( function() {
|
||||||
checkOverlayPosition( "after zoom and pan using image coordinates" );
|
checkOverlayPosition( "after zoom and pan using image coordinates" );
|
||||||
|
|
||||||
viewer.viewport.goHome();
|
viewer.goHome();
|
||||||
waitForViewer( function() {
|
waitForViewer( function() {
|
||||||
checkOverlayPosition( "after goHome using image coordinates" );
|
checkOverlayPosition( "after goHome using image coordinates" );
|
||||||
start();
|
start();
|
||||||
@ -333,7 +333,7 @@
|
|||||||
waitForViewer( function() {
|
waitForViewer( function() {
|
||||||
checkOverlayPosition( "after zoom and pan using viewport coordinates" );
|
checkOverlayPosition( "after zoom and pan using viewport coordinates" );
|
||||||
|
|
||||||
viewer.viewport.goHome();
|
viewer.goHome();
|
||||||
waitForViewer( function() {
|
waitForViewer( function() {
|
||||||
checkOverlayPosition( "after goHome using viewport coordinates" );
|
checkOverlayPosition( "after goHome using viewport coordinates" );
|
||||||
start();
|
start();
|
||||||
|
Loading…
Reference in New Issue
Block a user