mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
add new layer just before the current layer
This commit is contained in:
parent
9fafa8b7a7
commit
6566ca07a5
@ -233,8 +233,9 @@
|
|||||||
ns.PiskelController.prototype.duplicateCurrentLayer = function () {
|
ns.PiskelController.prototype.duplicateCurrentLayer = function () {
|
||||||
var layer = this.getCurrentLayer();
|
var layer = this.getCurrentLayer();
|
||||||
var clone = pskl.utils.LayerUtils.clone(layer);
|
var clone = pskl.utils.LayerUtils.clone(layer);
|
||||||
this.piskel.addLayer(clone);
|
var currentLayerIndex = this.getCurrentLayerIndex();
|
||||||
this.setCurrentLayerIndex(this.piskel.getLayers().length - 1);
|
this.piskel.addLayerAt(clone, currentLayerIndex + 1);
|
||||||
|
this.setCurrentLayerIndex(currentLayerIndex + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.PiskelController.prototype.createLayer = function (name) {
|
ns.PiskelController.prototype.createLayer = function (name) {
|
||||||
@ -246,9 +247,9 @@
|
|||||||
for (var i = 0 ; i < this.getFrameCount() ; i++) {
|
for (var i = 0 ; i < this.getFrameCount() ; i++) {
|
||||||
layer.addFrame(this.createEmptyFrame_());
|
layer.addFrame(this.createEmptyFrame_());
|
||||||
}
|
}
|
||||||
this.piskel.addLayer(layer);
|
var currentLayerIndex = this.getCurrentLayerIndex();
|
||||||
this.setCurrentLayerIndex(this.piskel.getLayers().length - 1);
|
this.piskel.addLayerAt(layer, currentLayerIndex + 1);
|
||||||
|
this.setCurrentLayerIndex(currentLayerIndex + 1);
|
||||||
} else {
|
} else {
|
||||||
throw 'Layer name should be unique';
|
throw 'Layer name should be unique';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user