mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
select previous layer after deleting layer
This commit is contained in:
parent
b6fa769ba1
commit
08b97cb6f0
@ -270,12 +270,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.PiskelController.prototype.removeLayerAt = function (index) {
|
ns.PiskelController.prototype.removeLayerAt = function (index) {
|
||||||
if (this.getLayers().length > 1) {
|
if (!this.hasLayerAt(index)) {
|
||||||
var layer = this.getLayerAt(index);
|
return;
|
||||||
if (layer) {
|
|
||||||
this.piskel.removeLayer(layer);
|
|
||||||
this.setCurrentLayerIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var layer = this.getLayerAt(index);
|
||||||
|
this.piskel.removeLayer(layer);
|
||||||
|
|
||||||
|
// Update the selected layer if needed.
|
||||||
|
if (this.getCurrentLayerIndex() === index) {
|
||||||
|
this.setCurrentLayerIndex(Math.max(0, index - 1));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user