-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmouse-up-event.js
32 lines (32 loc) · 1 KB
/
mouse-up-event.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const mouseUpModule = (() => {
const mouseUp = () => {
switch (commonModules.tool) {
case "PENCIL":
commonModules.pencil.isDrawing = false;
commonModules.tools.push(commonModules.pencil);
break;
case "ERASER":
commonModules.eraser.isEraser = false;
commonModules.tools.push(commonModules.eraser);
break;
case "SHAPE":
commonModules.shape.isDrawing = false;
commonModules.tools.push(commonModules.shape);
commonModules.lastShapeIndex = commonModules.tools.length - 1;
commonModules.shape.drawDashRect();
break;
case "SELECT":
commonModules.isDragging = false;
if (commonModules.tools[commonModules.lastShapeIndex].name == "SHAPE")
commonModules.tools[commonModules.lastShapeIndex].drawDashRect();
break;
default:
commonModules.isRotated = false;
commonModules.tool = commonModules.preTool;
break;
}
};
return {
mouseUp,
};
})();