summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-29 20:09:42 -0500
committersanine <sanine.not@pm.me>2022-05-29 20:09:42 -0500
commit76d7e6c00ec11a72adfcb10fbfad6d92a873b253 (patch)
tree463940067ca37449c72b2853d2abf0152d8ba870 /src/main.js
parentbc6f5873f17ae10f42f87825ac64b136cfee3d72 (diff)
add centered zooming
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.js b/src/main.js
index 5c9b085..d618d05 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,7 +5,7 @@ const $ = id => document.getElementById(id)
window.onload = () => {
const canvas = new Canvas('root');
- const pos = canvas.mousePos;
+ const pos = canvas.mouse.drawingPos;
canvas.onMouseMove = () => canvas.draw();
canvas.onDraw = ct => {
@@ -19,9 +19,9 @@ window.onload = () => {
ct.fillRect(2/3, 2/3, 1/3, 1/3);
ct.strokeStyle = '#fff';
- ct.lineWidth = 1/(canvas.zoom * canvas.scale);
+ ct.lineWidth = canvas.pixelsToUnits(1);
ct.beginPath();
- ct.arc(pos.x, pos.y, 30 /(canvas.zoom * canvas.scale), 0, 2*Math.PI);
+ ct.arc(pos.x, pos.y, canvas.pixelsToUnits(30), 0, 2*Math.PI);
ct.closePath();
ct.stroke();
};