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,11 +224,13 @@
|
||||
this.selectLayer(layer);
|
||||
};
|
||||
|
||||
ns.PiskelController.prototype.removeCurrentLayer = function () {
|
||||
ns.PiskelController.prototype.removeLayerAt = function (index) {
|
||||
if (this.getLayers().length > 1) {
|
||||
var layer = this.getCurrentLayer();
|
||||
this.piskel.removeLayer(layer);
|
||||
this.setCurrentLayerIndex(0);
|
||||
var layer = this.getLayerAt(index);
|
||||
if (layer) {
|
||||
this.piskel.removeLayer(layer);
|
||||
this.setCurrentLayerIndex(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -123,13 +123,14 @@
|
||||
};
|
||||
|
||||
ns.PublicPiskelController.prototype.removeCurrentLayer = function () {
|
||||
this.raiseSaveStateEvent_(this.piskelController.removeCurrentLayer, []);
|
||||
this.piskelController.removeCurrentLayer();
|
||||
var currentLayerIndex = this.getCurrentLayerIndex();
|
||||
this.raiseSaveStateEvent_(this.piskelController.removeLayerAt, [currentLayerIndex]);
|
||||
this.piskelController.removeLayerAt(currentLayerIndex);
|
||||
$.publish(Events.PISKEL_RESET);
|
||||
};
|
||||
|
||||
ns.PublicPiskelController.prototype.getCurrentLayerIndex = function () {
|
||||
return this.piskelController.currentLayerIndex;
|
||||
return this.piskelController.getCurrentLayerIndex();
|
||||
};
|
||||
|
||||
ns.PublicPiskelController.prototype.getCurrentFrameIndex = function () {
|
||||
|
@ -110,8 +110,10 @@
|
||||
this.replayState(state);
|
||||
}
|
||||
|
||||
var lastState = this.stateQueue[index];
|
||||
this.setupState(lastState);
|
||||
var lastState = this.stateQueue[index+1];
|
||||
if (lastState) {
|
||||
this.setupState(lastState);
|
||||
}
|
||||
this.currentIndex = index;
|
||||
$.publish(Events.PISKEL_RESET);
|
||||
if (originalSize !== this.getPiskelSize_()) {
|
||||
|
Loading…
Reference in New Issue
Block a user