summaryrefslogtreecommitdiff
path: root/src/modules/Mouse.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-31 20:52:15 -0500
committersanine <sanine.not@pm.me>2022-05-31 20:52:15 -0500
commit5efc7885e1c3959aa165be640858ffb3f8a5860b (patch)
tree6865327d6affd6df2c4f61ed3b9d5ab446e2b23e /src/modules/Mouse.js
parent8aa6645f2311de78f74b35f804cc45c7fcf38f57 (diff)
refactor: remove modules/ folder
Diffstat (limited to 'src/modules/Mouse.js')
-rw-r--r--src/modules/Mouse.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/modules/Mouse.js b/src/modules/Mouse.js
deleted file mode 100644
index 0b8f922..0000000
--- a/src/modules/Mouse.js
+++ /dev/null
@@ -1,53 +0,0 @@
-class Mouse {
- constructor(ct) {
- this.ct = ct;
- this.x = 0;
- this.y = 0;
- this.radius = 0.005;
- this.show = false;
- this.pressed = false;
- this.onMove = null;
-
- window.addEventListener('mousemove', e => {
- /* get current transform matrix */
- const matrix = this.ct.getTransform();
- matrix.invertSelf();
-
- const x = e.offsetX; const y = e.offsetY;
- this.x = matrix.a*x + matrix.b*y;
- this.y = matrix.c*x + matrix.d*y;
-
- if (this.onMove) this.onMove();
- });
-
- const root = document.getElementById('root');
-
- root.addEventListener('mouseover', e => {
- e = e ? e : window.event;
- this.show = true;
- });
-
- root.addEventListener('mouseout', e => {
- e = e ? e: window.event;
- this.show = false;
- });
- }
-
- render(ct) {
- if (!this.show) return;
- console.log(this.radius);
- ct.save();
-
- ct.strokeStyle = '#fff';
-
- ct.beginPath();
- ct.arc(this.x, this.y, this.radius, 0, 2*Math.PI);
- ct.closePath();
- ct.stroke();
-
- ct.restore();
- }
-}
-
-
-export default Mouse;