Added back eraser tool

This commit is contained in:
unsettledgames
2021-10-27 10:43:51 +02:00
parent 35cbe31a71
commit b2fef6154d
9 changed files with 84 additions and 95 deletions

View File

@ -1,5 +1,7 @@
const ToolManager = (() => {
brush = new BrushTool("brush", {type: 'html'});
brush = new BrushTool("brush", {type: 'html'}, switchTool);
eraser = new EraserTool("eraser", {type: 'html'}, switchTool);
currTool = brush;
Events.on("mouseup", window, onMouseUp);
@ -63,6 +65,14 @@ const ToolManager = (() => {
return currTool;
}
function switchTool(newTool) {
console.log("switch");
currTool.onDeselect();
currTool = newTool;
currTool.onSelect();
}
return {
currentTool
}