Compare commits
8 Commits
0e9500196f
...
323a767abc
| Author | SHA1 | Date | |
|---|---|---|---|
| 323a767abc | |||
| 542b72b6a8 | |||
| 71ec89539d | |||
| b189202344 | |||
| 7c9402143b | |||
| c9650744ed | |||
| cfbfb1e9b6 | |||
| e0d88e6653 |
@ -76,7 +76,20 @@
|
||||
};
|
||||
}
|
||||
|
||||
function handleCanvasClick() {
|
||||
function handleCanvasClick(event) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user