Update coords box to behave based on grid mode.

This commit is contained in:
Yaro Kasear 2025-12-09 11:19:16 -06:00
parent 5cc47c4a81
commit 9ddbacb4de

View file

@ -511,7 +511,6 @@ gridEl.addEventListener('pointermove', (e) => {
const { ix, iy, x: snapX, y: snapY } = snapToGrid(e.clientX, e.clientY); const { ix, iy, x: snapX, y: snapY } = snapToGrid(e.clientX, e.clientY);
coordsEl.innerText = `(${ix}, ${iy})`;
const renderX = snapX - {{ dot_size }} / 2; const renderX = snapX - {{ dot_size }} / 2;
const renderY = snapY - {{ dot_size }} / 2; const renderY = snapY - {{ dot_size }} / 2;
@ -522,6 +521,19 @@ gridEl.addEventListener('pointermove', (e) => {
dotEl.style.top = `${renderY}px`; dotEl.style.top = `${renderY}px`;
dotEl.style.left = `${renderX}px`; dotEl.style.left = `${renderX}px`;
const type = getActiveType();
var coordsX = `${renderX}px`;
var coordsY = `${renderY}px`;
if (type === 'fullGrid' || type === 'verticalGrid') {
coordsX = `${ix}g`;
}
if (type === 'fullGrid' || type === 'horizontalGrid') {
coordsY = `${iy}g`;
}
coordsEl.innerText = `(${coordsX}, ${coordsY})`;
if (currentShape) { if (currentShape) {
const tool = currentShape.tool; const tool = currentShape.tool;