Move brushPreview when panning with mousewheel

This commit is contained in:
Jascha Bakarinow 2021-07-17 22:55:51 +02:00
parent ae82d64d5d
commit d4de08e8be
2 changed files with 5 additions and 2 deletions

View File

@ -38,6 +38,7 @@ window.addEventListener("mousedown", function (mouseEvent) {
}
else if (mouseEvent.which == 2) {
currentTool = tool.pan;
tool.pan.brushSize = currentToolTemp.brushSize;
}
else if (currentTool.name == 'pencil' && mouseEvent.which == 3) {
currentTool = tool.resizebrush;
@ -171,6 +172,8 @@ window.addEventListener("mouseup", function (mouseEvent) {
currentTool = currentToolTemp;
currentTool.updateCursor();
var cursorLocation = getCursorPosition(mouseEvent);
currentTool.moveBrushPreview(cursorLocation);
}, false);

View File

@ -18,10 +18,10 @@ class Tool {
if (options.imageCursor) this.cursor = "url(\'/pixel-editor/"+options.imageCursor+".png\'), auto";
this.currentBrushSize = 1;
this.previousBrushSize = 1;
if (options.brushPreview) {
this.brushPreview = true;
this.currentBrushSize = 1;
this.previousBrushSize = 1;
}
//add to tool object so it can be referenced