mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Added undo management for rectangle tool
This commit is contained in:
parent
ab0b3e81e3
commit
3bf5d5fbd3
@ -2,7 +2,6 @@ function changeTool (selectedTool) {
|
|||||||
// Ending any selection in progress
|
// Ending any selection in progress
|
||||||
if (currentTool.includes("select") && !selectedTool.includes("select") && !selectionCanceled) {
|
if (currentTool.includes("select") && !selectedTool.includes("select") && !selectionCanceled) {
|
||||||
endSelection();
|
endSelection();
|
||||||
console.log("FINISCO");
|
|
||||||
}
|
}
|
||||||
//set tool and temp tje tje tpp;
|
//set tool and temp tje tje tpp;
|
||||||
currentTool = selectedTool;
|
currentTool = selectedTool;
|
||||||
|
@ -21,7 +21,8 @@ window.addEventListener("mousedown", function (mouseEvent) {
|
|||||||
currentTool = 'pan';
|
currentTool = 'pan';
|
||||||
else if (mouseEvent.altKey)
|
else if (mouseEvent.altKey)
|
||||||
currentTool = 'eyedropper';
|
currentTool = 'eyedropper';
|
||||||
else if (mouseEvent.target.className == 'drawingCanvas' && (currentTool == 'pencil' || currentTool == 'eraser'))
|
else if (mouseEvent.target.className == 'drawingCanvas' &&
|
||||||
|
(currentTool == 'pencil' || currentTool == 'eraser' || currentTool == 'rectangle'))
|
||||||
new HistoryStateEditCanvas();
|
new HistoryStateEditCanvas();
|
||||||
else if (currentTool == 'moveselection') {
|
else if (currentTool == 'moveselection') {
|
||||||
if (!cursorInSelectedArea()) {
|
if (!cursorInSelectedArea()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user