mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Merge pull request #2239 from pearcetm/viewer-destroy-event
Viewer destroy event
This commit is contained in:
commit
b8cc7e171e
@ -756,6 +756,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
* viewer = null; //important
|
||||
*
|
||||
* @function
|
||||
* @fires OpenSeadragon.Viewer.event:before-destroy
|
||||
* @fires OpenSeadragon.Viewer.event:destroy
|
||||
*/
|
||||
destroy: function( ) {
|
||||
if ( !THIS[ this.hash ] ) {
|
||||
@ -763,6 +765,17 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raised when the viewer is about to be destroyed (see {@link OpenSeadragon.Viewer#before-destroy}).
|
||||
*
|
||||
* @event before-destroy
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
* @type {object}
|
||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.raiseEvent( 'before-destroy' );
|
||||
|
||||
this._removeUpdatePixelDensityRatioEvent();
|
||||
|
||||
this.close();
|
||||
@ -795,7 +808,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
this.navigator = null;
|
||||
}
|
||||
|
||||
this.removeAllHandlers();
|
||||
|
||||
if (this.buttonGroup) {
|
||||
this.buttonGroup.destroy();
|
||||
@ -841,6 +853,19 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
|
||||
// clear our reference to the main element - they will need to pass it in again, creating a new viewer
|
||||
this.element = null;
|
||||
|
||||
/**
|
||||
* Raised when the viewer is destroyed (see {@link OpenSeadragon.Viewer#destroy}).
|
||||
*
|
||||
* @event destroy
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
* @type {object}
|
||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.raiseEvent( 'destroy' );
|
||||
|
||||
this.removeAllHandlers();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -514,7 +514,7 @@ $.Viewport.prototype = {
|
||||
* @param {OpenSeadragon.Rect} bounds
|
||||
* @returns {OpenSeadragon.Rect} constrained bounds.
|
||||
*/
|
||||
_applyBoundaryConstraints: function(bounds) {
|
||||
_applyBoundaryConstraints: function(bounds) {
|
||||
var newBounds = new $.Rect(
|
||||
bounds.x,
|
||||
bounds.y,
|
||||
|
Loading…
Reference in New Issue
Block a user