mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed bug when undoing layer add
Also created nAppLayers to save the number of layers used by the editor (and that the use can't directly with).
This commit is contained in:
@ -12,7 +12,7 @@ function newPixel (width, height, editorMode, fileContent = null) {
|
||||
}
|
||||
else {
|
||||
let nLayers = layers.length;
|
||||
for (let i=2; i < layers.length - 2; i++) {
|
||||
for (let i=2; i < layers.length - nAppLayers; i++) {
|
||||
let currentEntry = layers[i].menuEntry;
|
||||
let associatedLayer;
|
||||
|
||||
@ -31,7 +31,7 @@ function newPixel (width, height, editorMode, fileContent = null) {
|
||||
}
|
||||
|
||||
// Removing the old layers from the list
|
||||
for (let i=2; i<nLayers - 2; i++) {
|
||||
for (let i=2; i<nLayers - nAppLayers; i++) {
|
||||
layers.splice(2, 1);
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ function newPixel (width, height, editorMode, fileContent = null) {
|
||||
layers.push(currentLayer);
|
||||
layers.push(VFXLayer);
|
||||
layers.push(TMPLayer);
|
||||
layers.push(pixelGrid);
|
||||
}
|
||||
|
||||
//remove current palette
|
||||
@ -113,6 +114,7 @@ function newPixel (width, height, editorMode, fileContent = null) {
|
||||
|
||||
//fill background of canvas with bg color
|
||||
fillCheckerboard();
|
||||
fillPixelGrid();
|
||||
|
||||
//reset undo and redo states
|
||||
undoStates = [];
|
||||
|
Reference in New Issue
Block a user