mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fix brushPreview lagging behind
This commit is contained in:
parent
f240e54bb3
commit
e0f64c97ba
@ -217,8 +217,6 @@ function draw (mouseEvent) {
|
|||||||
//if a document hasnt yet been created or the current layer is locked, exit this function
|
//if a document hasnt yet been created or the current layer is locked, exit this function
|
||||||
if (!documentCreated || dialogueOpen || !currentLayer.isVisible || currentLayer.isLocked) return;
|
if (!documentCreated || dialogueOpen || !currentLayer.isVisible || currentLayer.isLocked) return;
|
||||||
|
|
||||||
// Moving brush preview
|
|
||||||
currentTool.moveBrushPreview(cursorLocation);
|
|
||||||
// Hiding eyedropper, will be shown if it's needed
|
// Hiding eyedropper, will be shown if it's needed
|
||||||
eyedropperPreview.style.display = 'none';
|
eyedropperPreview.style.display = 'none';
|
||||||
|
|
||||||
@ -307,6 +305,9 @@ function draw (mouseEvent) {
|
|||||||
for (let i=1; i<layers.length; i++) {
|
for (let i=1; i<layers.length; i++) {
|
||||||
layers[i].copyData(layers[0]);
|
layers[i].copyData(layers[0]);
|
||||||
}
|
}
|
||||||
|
// Updating cursorLocation with new layer position
|
||||||
|
lastMouseMovePos = getCursorPosition(mouseEvent);
|
||||||
|
cursorLocation = lastMouseMovePos;
|
||||||
}
|
}
|
||||||
else if (currentTool.name == 'eyedropper' && dragging && mouseEvent.target.className == 'drawingCanvas') {
|
else if (currentTool.name == 'eyedropper' && dragging && mouseEvent.target.className == 'drawingCanvas') {
|
||||||
let selectedColor = getEyedropperColor(cursorLocation);
|
let selectedColor = getEyedropperColor(cursorLocation);
|
||||||
@ -420,6 +421,9 @@ function draw (mouseEvent) {
|
|||||||
}
|
}
|
||||||
currentLayer.updateLayerPreview();
|
currentLayer.updateLayerPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moving brush preview
|
||||||
|
currentTool.moveBrushPreview(cursorLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseEvent.target.className == 'drawingCanvas')
|
if (mouseEvent.target.className == 'drawingCanvas')
|
||||||
|
Loading…
Reference in New Issue
Block a user