Added LayerList to handle all the functions that involve more than 1 layer

Merge, flatten, add layer, delete layer etc, I'm planning to move a few global variables in Layer to LayerList.
This commit is contained in:
unsettledgames
2021-07-22 22:42:41 +02:00
parent 804a0335b1
commit 6e4ab3990d
10 changed files with 692 additions and 694 deletions

View File

@ -61,14 +61,14 @@ const FileManager = (() => {
// Merging every layer on the export canvas
for (let i=0; i<layersCopy.length; i++) {
if (layersCopy[i].menuEntry != null && layersCopy[i].isVisible) {
mergeLayers(exportCanvas.getContext('2d'), layersCopy[i].context);
LayerList.mergeLayers(exportCanvas.getContext('2d'), layersCopy[i].context);
}
// I'm not going to find out why the layer ordering screws up if you don't copy
// a blank canvas when layers[i] is not set as visible, but if you have time to
// spend, feel free to investigate (comment the else, create 3 layers: hide the
// middle one and export, the other 2 will be swapped in their order)
else {
mergeLayers(exportCanvas.getContext('2d'), emptyCanvas.getContext('2d'));
LayerList.mergeLayers(exportCanvas.getContext('2d'), emptyCanvas.getContext('2d'));
}
}