Added layer move

The user can now move layers and choose which one to put on top of each other just by dragging and dropping them in the layer menu. Also fixed a bug in the eyedropper, that can now pick a colour even though the layer it's on is not selected.
This commit is contained in:
unsettledgames
2020-06-19 23:31:36 +02:00
parent 6cdc764586
commit ab4129546c
5 changed files with 131 additions and 25 deletions

View File

@ -1,10 +1,22 @@
function newPixel (width, height, palette) {
layerList = document.getElementById("layers-menu");
layerListEntry = layerList.firstElementChild;
let firstPixel = true;
function newPixel (width, height, palette) {
if (firstPixel) {
layerList = document.getElementById("layers-menu");
layerListEntry = layerList.firstElementChild;
firstPixel = false;
}
else {
// TODO: clean layers before creating a new pixel
// Devo togliere tutte le entries tranne la prima
// Devo pulire la preview della prima entry
// Devo cancellare tutte le tele tranne quella con id pixel-canvas
}
console.log("Layer entry: " + layerListEntry);
// Setting up the current layer
currentLayer = new Layer(width, height, canvas, layerListEntry);
canvas.style.zIndex = 2;
// Cloning the entry so that when I change something on the first layer, those changes aren't
// propagated to the other ones