|
@@ -98,7 +98,7 @@ const tools = {
|
|
|
};
|
|
|
|
|
|
function superHandler(evt) {
|
|
|
- let t = tools[tool.value];
|
|
|
+ const t = tools[tool.value];
|
|
|
if (typeof t[evt.type] === 'function') t[evt.type].call(this, evt);
|
|
|
}
|
|
|
|
|
@@ -165,10 +165,6 @@ class Circle extends Drawable {
|
|
|
in(x, y) {
|
|
|
return this.distanceTo(x, y) < this.radius;
|
|
|
}
|
|
|
-
|
|
|
- inBounds(x, y, w, h) {
|
|
|
- return this.x >= x && this.x <= x + w && this.y >= y && this.y <= y + h;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class Line extends Drawable {
|
|
@@ -211,10 +207,6 @@ class Line extends Drawable {
|
|
|
rotateY >= -this.lineWidth / 2
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
- get length() {
|
|
|
- return this.distanceTo(this.x + this.width, this.y + this.height);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class Rectangle extends Drawable {
|
|
@@ -284,18 +276,14 @@ class Ellipse extends Drawable {
|
|
|
in(x, y) {
|
|
|
return this.distanceTo(x, y) < this.radius;
|
|
|
}
|
|
|
-
|
|
|
- inBounds(x, y, w, h) {
|
|
|
- return this.x >= x && this.x <= x + w && this.y >= y && this.y <= y + h;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
-document.getElementById('delete').onclick = () => {
|
|
|
+remove.onclick = () => {
|
|
|
Drawable.instances = [];
|
|
|
Drawable.drawAll();
|
|
|
};
|
|
|
|
|
|
-document.getElementById('undo').onclick = function () {
|
|
|
+undo.onclick = function () {
|
|
|
Drawable.instances.pop();
|
|
|
Drawable.drawAll();
|
|
|
};
|