mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Added back rectangle tool
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
const ToolManager = (() => {
|
||||
brush = new BrushTool("brush", {type: 'html'}, switchTool);
|
||||
eraser = new EraserTool("eraser", {type: 'html'}, switchTool);
|
||||
rectangle = new RectangleTool("rectangle", {type: 'html'}, switchTool);
|
||||
|
||||
currTool = brush;
|
||||
|
||||
@ -13,7 +14,7 @@ const ToolManager = (() => {
|
||||
return;
|
||||
|
||||
let mousePos = Input.getCursorPosition(mouseEvent);
|
||||
console.log("here");
|
||||
|
||||
switch(mouseEvent.which) {
|
||||
case 1:
|
||||
if (!Input.isDragging()) {
|
||||
@ -47,15 +48,15 @@ const ToolManager = (() => {
|
||||
let mousePos = Input.getCursorPosition(mouseEvent);
|
||||
|
||||
switch(mouseEvent.which) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (Input.isDragging()) {
|
||||
currTool.onEnd(mousePos);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -66,8 +67,6 @@ const ToolManager = (() => {
|
||||
}
|
||||
|
||||
function switchTool(newTool) {
|
||||
console.log("switch");
|
||||
|
||||
currTool.onDeselect();
|
||||
currTool = newTool;
|
||||
currTool.onSelect();
|
||||
|
Reference in New Issue
Block a user