mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Better handle destruction when navigator in custom location
This commit is contained in:
parent
4ab8cc7481
commit
8178687298
@ -399,14 +399,22 @@ $.extend( $.Button.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
if (this.imgRest) {
|
||||
this.element.removeChild(this.imgRest);
|
||||
this.imgRest = null;
|
||||
}
|
||||
if (this.imgGroup) {
|
||||
this.element.removeChild(this.imgGroup);
|
||||
this.imgGroup = null;
|
||||
}
|
||||
if (this.imgHover) {
|
||||
this.element.removeChild(this.imgHover);
|
||||
this.imgHover = null;
|
||||
}
|
||||
if (this.imgDown) {
|
||||
this.element.removeChild(this.imgDown);
|
||||
this.imgDown = null;
|
||||
}
|
||||
this.removeAllHandlers();
|
||||
this.tracker.destroy();
|
||||
this.element = null;
|
||||
|
@ -161,7 +161,9 @@ $.Control.prototype = {
|
||||
*/
|
||||
destroy: function() {
|
||||
this.wrapper.removeChild( this.element );
|
||||
if (this.anchor !== $.ControlAnchor.NONE) {
|
||||
this.container.removeChild(this.wrapper);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -775,7 +775,13 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
this.removeAllHandlers();
|
||||
|
||||
if (this.buttons) {
|
||||
if (this.buttons instanceof $.ButtonGroup) {
|
||||
this.buttons.destroy();
|
||||
} else {
|
||||
while (this.buttons.length) {
|
||||
this.buttons.pop().destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.paging) {
|
||||
@ -1869,6 +1875,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
{anchor: this.navigationControlAnchor || $.ControlAnchor.TOP_LEFT}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.buttons = buttons;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user