mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed layer issue
This commit is contained in:
parent
9fc5c8e3b8
commit
29746551e1
|
@ -301,7 +301,7 @@ svg {
|
||||||
}
|
}
|
||||||
|
|
||||||
#pixel-canvas {
|
#pixel-canvas {
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ svg {
|
||||||
}
|
}
|
||||||
|
|
||||||
#tmp-canvas {
|
#tmp-canvas {
|
||||||
z-index: 4;
|
z-index: 5;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,13 +430,13 @@ function duplicateLayer(event, saveHistory = true) {
|
||||||
for (let i=getMenuEntryIndex(menuEntries, toDuplicate.menuEntry) - 1; i>=0; i--) {
|
for (let i=getMenuEntryIndex(menuEntries, toDuplicate.menuEntry) - 1; i>=0; i--) {
|
||||||
getLayerByID(menuEntries[i].id).canvas.style.zIndex++;
|
getLayerByID(menuEntries[i].id).canvas.style.zIndex++;
|
||||||
}
|
}
|
||||||
maxZIndex++;
|
maxZIndex+=2;
|
||||||
|
|
||||||
// Creating a new canvas
|
// Creating a new canvas
|
||||||
let newCanvas = document.createElement("canvas");
|
let newCanvas = document.createElement("canvas");
|
||||||
// Setting up the new canvas
|
// Setting up the new canvas
|
||||||
canvasView.append(newCanvas);
|
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");
|
newCanvas.classList.add("drawingCanvas");
|
||||||
|
|
||||||
if (!layerListEntry) return console.warn('skipping adding layer because no document');
|
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");
|
let newCanvas = document.createElement("canvas");
|
||||||
// Setting up the new canvas
|
// Setting up the new canvas
|
||||||
canvasView.append(newCanvas);
|
canvasView.append(newCanvas);
|
||||||
maxZIndex++;
|
maxZIndex+=2;
|
||||||
newCanvas.style.zIndex = maxZIndex;
|
newCanvas.style.zIndex = maxZIndex;
|
||||||
newCanvas.classList.add("drawingCanvas");
|
newCanvas.classList.add("drawingCanvas");
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,11 @@ function diagLine(lastMouseClickPos, zoom, cursorLocation) {
|
||||||
const context = canvas.getContext('2d');
|
const context = canvas.getContext('2d');
|
||||||
|
|
||||||
context.fillStyle=currentGlobalColor;
|
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) {
|
while (true) {
|
||||||
if (currentTool.name !== 'line') return;
|
if (currentTool.name !== 'line') return;
|
||||||
|
|
|
@ -20,7 +20,7 @@ let endRectY;
|
||||||
*/
|
*/
|
||||||
function startRectDrawing(mouseEvent) {
|
function startRectDrawing(mouseEvent) {
|
||||||
// Putting the vfx layer on top of everything
|
// 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
|
// Updating flag
|
||||||
isDrawingRect = true;
|
isDrawingRect = true;
|
||||||
|
|
||||||
|
@ -141,5 +141,5 @@ function setRectToolSvg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyChanges() {
|
function applyChanges() {
|
||||||
VFXCanvas.style.zIndex = MIN_Z_INDEX;
|
//VFXCanvas.style.zIndex = MIN_Z_INDEX;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user