mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4e85ad1a73
@ -37,6 +37,7 @@ window.addEventListener("mousedown", function (mouseEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mouseEvent.which == 2) {
|
else if (mouseEvent.which == 2) {
|
||||||
|
tool.pan.brushSize = currentTool.brushSize;
|
||||||
currentTool = tool.pan;
|
currentTool = tool.pan;
|
||||||
}
|
}
|
||||||
else if (currentTool.name == 'pencil' && mouseEvent.which == 3) {
|
else if (currentTool.name == 'pencil' && mouseEvent.which == 3) {
|
||||||
@ -172,6 +173,8 @@ window.addEventListener("mouseup", function (mouseEvent) {
|
|||||||
currentTool = currentToolTemp;
|
currentTool = currentToolTemp;
|
||||||
|
|
||||||
currentTool.updateCursor();
|
currentTool.updateCursor();
|
||||||
|
var cursorLocation = getCursorPosition(mouseEvent);
|
||||||
|
currentTool.moveBrushPreview(cursorLocation);
|
||||||
|
|
||||||
|
|
||||||
}, false);
|
}, false);
|
||||||
@ -215,8 +218,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 || Dialogue.isOpen() || !currentLayer.isVisible || currentLayer.isLocked) return;
|
if (!documentCreated || Dialogue.isOpen() || !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';
|
||||||
|
|
||||||
@ -305,6 +306,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') {
|
||||||
|
|
||||||
@ -420,6 +424,9 @@ function draw (mouseEvent) {
|
|||||||
}
|
}
|
||||||
currentLayer.updateLayerPreview();
|
currentLayer.updateLayerPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moving brush preview
|
||||||
|
currentTool.moveBrushPreview(cursorLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseEvent.target.className == 'drawingCanvas')
|
if (mouseEvent.target.className == 'drawingCanvas')
|
||||||
|
@ -18,10 +18,10 @@ class Tool {
|
|||||||
|
|
||||||
if (options.imageCursor) this.cursor = "url(\'/pixel-editor/"+options.imageCursor+".png\'), auto";
|
if (options.imageCursor) this.cursor = "url(\'/pixel-editor/"+options.imageCursor+".png\'), auto";
|
||||||
|
|
||||||
if (options.brushPreview) {
|
|
||||||
this.brushPreview = true;
|
|
||||||
this.currentBrushSize = 1;
|
this.currentBrushSize = 1;
|
||||||
this.previousBrushSize = 1;
|
this.previousBrushSize = 1;
|
||||||
|
if (options.brushPreview) {
|
||||||
|
this.brushPreview = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add to tool object so it can be referenced
|
//add to tool object so it can be referenced
|
||||||
|
Loading…
Reference in New Issue
Block a user