Fixed layer issue

This commit is contained in:
Leamsi Escribano 2021-01-15 10:11:13 -05:00
parent 9fc5c8e3b8
commit 29746551e1
4 changed files with 12 additions and 9 deletions

View File

@ -301,7 +301,7 @@ svg {
}
#pixel-canvas {
z-index: 2;
z-index: 3;
background: transparent;
}
@ -311,7 +311,7 @@ svg {
}
#tmp-canvas {
z-index: 4;
z-index: 5;
background: transparent;
}

View File

@ -430,13 +430,13 @@ function duplicateLayer(event, saveHistory = true) {
for (let i=getMenuEntryIndex(menuEntries, toDuplicate.menuEntry) - 1; i>=0; i--) {
getLayerByID(menuEntries[i].id).canvas.style.zIndex++;
}
maxZIndex++;
maxZIndex+=2;
// Creating a new canvas
let newCanvas = document.createElement("canvas");
// Setting up the new canvas
canvasView.append(newCanvas);
newCanvas.style.zIndex = parseInt(currentLayer.canvas.style.zIndex) + 1;
newCanvas.style.zIndex = parseInt(currentLayer.canvas.style.zIndex) + 2;
newCanvas.classList.add("drawingCanvas");
if (!layerListEntry) return console.warn('skipping adding layer because no document');
@ -529,7 +529,7 @@ function addLayer(id, saveHistory = true) {
let newCanvas = document.createElement("canvas");
// Setting up the new canvas
canvasView.append(newCanvas);
maxZIndex++;
maxZIndex+=2;
newCanvas.style.zIndex = maxZIndex;
newCanvas.classList.add("drawingCanvas");

View File

@ -17,8 +17,11 @@ function diagLine(lastMouseClickPos, zoom, cursorLocation) {
const context = canvas.getContext('2d');
context.fillStyle=currentGlobalColor;
canvas.style.zIndex = MAX_Z_INDEX;
context.clearRect(0, 0, canvas.width, canvas.height);
context.clearRect(0, 0, canvas.width, canvas.height);
canvas.style.zIndex = parseInt(currentLayer.canvas.style.zIndex, 10) + 1;
//console.log(canvas.style.zIndex, currentLayer.canvas.style.zIndex);
while (true) {
if (currentTool.name !== 'line') return;

View File

@ -20,7 +20,7 @@ let endRectY;
*/
function startRectDrawing(mouseEvent) {
// Putting the vfx layer on top of everything
VFXCanvas.style.zIndex = MAX_Z_INDEX;
VFXCanvas.style.zIndex = parseInt(currentLayer.canvas.style.zIndex, 10) + 1;;
// Updating flag
isDrawingRect = true;
@ -141,5 +141,5 @@ function setRectToolSvg() {
}
function applyChanges() {
VFXCanvas.style.zIndex = MIN_Z_INDEX;
//VFXCanvas.style.zIndex = MIN_Z_INDEX;
}