Finished implementing editor modes

This commit is contained in:
unsettledgames
2020-07-20 23:33:17 +02:00
parent e9e1ba96da
commit 6be8791dec
8 changed files with 63 additions and 10 deletions

View File

@@ -329,11 +329,14 @@ function flatten(onlyVisible) {
let nToFlatten = 0;
for (let i=0; i<layers.length; i++) {
console.log(layers[i].name);
if (layers[i].menuEntry != null && layers[i].isVisible) {
visibleLayers.push(layers[i]);
}
}
console.log("da piallare: " + visibleLayers.length);
// Sorting them by z-index
visibleLayers.sort((a, b) => (a.canvas.style.zIndex > b.canvas.style.zIndex) ? -1 : 1);
// Selecting the last visible layer (the only one that won't get deleted)