mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-16 14:53:14 +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
|
* viewer = null; //important
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
|
* @fires OpenSeadragon.Viewer.event:before-destroy
|
||||||
|
* @fires OpenSeadragon.Viewer.event:destroy
|
||||||
*/
|
*/
|
||||||
destroy: function( ) {
|
destroy: function( ) {
|
||||||
if ( !THIS[ this.hash ] ) {
|
if ( !THIS[ this.hash ] ) {
|
||||||
@ -763,6 +765,17 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
return;
|
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._removeUpdatePixelDensityRatioEvent();
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
@ -795,7 +808,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
this.navigator = null;
|
this.navigator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeAllHandlers();
|
|
||||||
|
|
||||||
if (this.buttonGroup) {
|
if (this.buttonGroup) {
|
||||||
this.buttonGroup.destroy();
|
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
|
// clear our reference to the main element - they will need to pass it in again, creating a new viewer
|
||||||
this.element = null;
|
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
|
* @param {OpenSeadragon.Rect} bounds
|
||||||
* @returns {OpenSeadragon.Rect} constrained bounds.
|
* @returns {OpenSeadragon.Rect} constrained bounds.
|
||||||
*/
|
*/
|
||||||
_applyBoundaryConstraints: function(bounds) {
|
_applyBoundaryConstraints: function(bounds) {
|
||||||
var newBounds = new $.Rect(
|
var newBounds = new $.Rect(
|
||||||
bounds.x,
|
bounds.x,
|
||||||
bounds.y,
|
bounds.y,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user