mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed undo bug for the rect selection
This commit is contained in:
parent
3bf5d5fbd3
commit
4b78e8fee1
@ -6,6 +6,7 @@ var lastMousePos;
|
|||||||
window.addEventListener("mousedown", function (mouseEvent) {
|
window.addEventListener("mousedown", function (mouseEvent) {
|
||||||
// Saving the event in case something else needs it
|
// Saving the event in case something else needs it
|
||||||
currentMouseEvent = mouseEvent;
|
currentMouseEvent = mouseEvent;
|
||||||
|
canDraw = true;
|
||||||
|
|
||||||
//if no document has been created yet, or this is a dialog open
|
//if no document has been created yet, or this is a dialog open
|
||||||
if (!documentCreated || dialogueOpen) return;
|
if (!documentCreated || dialogueOpen) return;
|
||||||
@ -27,14 +28,16 @@ window.addEventListener("mousedown", function (mouseEvent) {
|
|||||||
else if (currentTool == 'moveselection') {
|
else if (currentTool == 'moveselection') {
|
||||||
if (!cursorInSelectedArea()) {
|
if (!cursorInSelectedArea()) {
|
||||||
changeTool('pencil');
|
changeTool('pencil');
|
||||||
undo();
|
canDraw = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//saveHistoryState({type: 'canvas', canvas: context.getImageData(0, 0, canvasSize[0], canvasSize[1])});
|
//saveHistoryState({type: 'canvas', canvas: context.getImageData(0, 0, canvasSize[0], canvasSize[1])});
|
||||||
|
|
||||||
updateCursor();
|
updateCursor();
|
||||||
|
|
||||||
draw(mouseEvent);
|
if (canDraw) {
|
||||||
|
draw(mouseEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (currentTool == 'pencil' && mouseEvent.which == 3) {
|
else if (currentTool == 'pencil' && mouseEvent.which == 3) {
|
||||||
currentTool = 'resize-brush';
|
currentTool = 'resize-brush';
|
||||||
|
Loading…
Reference in New Issue
Block a user