mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
protect frame-picker destroy if frame picker init() was not called
This commit is contained in:
parent
a72b0c69e5
commit
00d4a1614b
@ -23,6 +23,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.AbstractImportStep.prototype.destroy = function () {
|
ns.AbstractImportStep.prototype.destroy = function () {
|
||||||
|
if (this.framePickerWidget) {
|
||||||
|
this.framePickerWidget.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
pskl.utils.Event.removeAllEventListeners(this);
|
pskl.utils.Event.removeAllEventListeners(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.InsertLocation.prototype.onShow = function () {
|
ns.InsertLocation.prototype.onShow = function () {
|
||||||
|
// Initialize the frame picker on show, to be able to calculate correctly the
|
||||||
|
// container's offsetWidth and offsetHeight.
|
||||||
this.currentPiskelFramePickerWidget.init();
|
this.currentPiskelFramePickerWidget.init();
|
||||||
|
|
||||||
var currentFrameIndex = this.piskelController.getCurrentFrameIndex();
|
var currentFrameIndex = this.piskelController.getCurrentFrameIndex();
|
||||||
this.currentPiskelFramePickerWidget.setFrameIndex(currentFrameIndex + 1);
|
this.currentPiskelFramePickerWidget.setFrameIndex(currentFrameIndex + 1);
|
||||||
this.currentPiskelFramePickerWidget.setFirstFrameIndex(0);
|
this.currentPiskelFramePickerWidget.setFirstFrameIndex(0);
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.SelectMode.prototype.destroy = function () {
|
ns.SelectMode.prototype.destroy = function () {
|
||||||
if (this.framePickerWidget) {
|
|
||||||
this.framePickerWidget.destroy();
|
|
||||||
}
|
|
||||||
this.superclass.destroy.call(this);
|
this.superclass.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.FramePicker.prototype.destroy = function () {
|
ns.FramePicker.prototype.destroy = function () {
|
||||||
this.container.removeChild(this.wrapper);
|
if (this.wrapper.parentNode) {
|
||||||
|
this.wrapper.parentNode.removeChild(this.wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
pskl.utils.Event.removeAllEventListeners(this);
|
pskl.utils.Event.removeAllEventListeners(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user