Compare commits
7 Commits
323a767abc
...
0e9500196f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e9500196f | |||
| 77cb74ad10 | |||
| 4e5b4fb249 | |||
| 0753ef40d5 | |||
| 09ff88289b | |||
| 388f7633e5 | |||
| 0db7cab23b |
@ -76,20 +76,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCanvasClick(event) {
|
function handleCanvasClick() {
|
||||||
// If we're about to turn off tracking, update position one last time
|
|
||||||
if (trackHover) {
|
|
||||||
const rect = canvas.getBoundingClientRect();
|
|
||||||
const mouseX = event.clientX - rect.left;
|
|
||||||
const mouseY = event.clientY - rect.top;
|
|
||||||
|
|
||||||
// Add half grid unit offset for snapping to closest grid intersection
|
|
||||||
userPoint = {
|
|
||||||
x: Math.floor((mouseX + GRID_SIZE / 2) / GRID_SIZE),
|
|
||||||
y: Math.floor((HEIGHT - mouseY + GRID_SIZE / 2) / GRID_SIZE)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
trackHover = !trackHover;
|
trackHover = !trackHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user