mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix : Loading state with delete frame/layer
The Frame and Layer selected after an undo/redo are now taken from the next state saved in the HistoryQueue.
This commit is contained in:
parent
7cbf2b2794
commit
c7c536dc80
@ -224,12 +224,14 @@
|
|||||||
this.selectLayer(layer);
|
this.selectLayer(layer);
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PiskelController.prototype.removeCurrentLayer = function () {
|
ns.PiskelController.prototype.removeLayerAt = function (index) {
|
||||||
if (this.getLayers().length > 1) {
|
if (this.getLayers().length > 1) {
|
||||||
var layer = this.getCurrentLayer();
|
var layer = this.getLayerAt(index);
|
||||||
|
if (layer) {
|
||||||
this.piskel.removeLayer(layer);
|
this.piskel.removeLayer(layer);
|
||||||
this.setCurrentLayerIndex(0);
|
this.setCurrentLayerIndex(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PiskelController.prototype.serialize = function (expanded) {
|
ns.PiskelController.prototype.serialize = function (expanded) {
|
||||||
|
@ -123,13 +123,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.PublicPiskelController.prototype.removeCurrentLayer = function () {
|
ns.PublicPiskelController.prototype.removeCurrentLayer = function () {
|
||||||
this.raiseSaveStateEvent_(this.piskelController.removeCurrentLayer, []);
|
var currentLayerIndex = this.getCurrentLayerIndex();
|
||||||
this.piskelController.removeCurrentLayer();
|
this.raiseSaveStateEvent_(this.piskelController.removeLayerAt, [currentLayerIndex]);
|
||||||
|
this.piskelController.removeLayerAt(currentLayerIndex);
|
||||||
$.publish(Events.PISKEL_RESET);
|
$.publish(Events.PISKEL_RESET);
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PublicPiskelController.prototype.getCurrentLayerIndex = function () {
|
ns.PublicPiskelController.prototype.getCurrentLayerIndex = function () {
|
||||||
return this.piskelController.currentLayerIndex;
|
return this.piskelController.getCurrentLayerIndex();
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PublicPiskelController.prototype.getCurrentFrameIndex = function () {
|
ns.PublicPiskelController.prototype.getCurrentFrameIndex = function () {
|
||||||
|
@ -110,8 +110,10 @@
|
|||||||
this.replayState(state);
|
this.replayState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastState = this.stateQueue[index];
|
var lastState = this.stateQueue[index+1];
|
||||||
|
if (lastState) {
|
||||||
this.setupState(lastState);
|
this.setupState(lastState);
|
||||||
|
}
|
||||||
this.currentIndex = index;
|
this.currentIndex = index;
|
||||||
$.publish(Events.PISKEL_RESET);
|
$.publish(Events.PISKEL_RESET);
|
||||||
if (originalSize !== this.getPiskelSize_()) {
|
if (originalSize !== this.getPiskelSize_()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user