update point B position on click before freezing tracking
This commit is contained in:
parent
542b72b6a8
commit
323a767abc
@ -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