fix(ui): offset context dialog for 16x16 arrow (8px left, 16px down) so it points at the click
All checks were successful
CI / test-and-build (push) Successful in 44s

This commit is contained in:
hermes-explorigin 2026-08-10 21:46:07 +00:00
parent 80e002ff3d
commit f054164e84

View File

@ -46,9 +46,13 @@
const title = $derived(feature?.name ?? savedPoint?.label ?? 'New location');
const rows = $derived(feature?.rows ?? []);
// Clamp the dialog within 40px of the map edges.
const LEFT = $derived(Math.min(Math.max(x, 8), window.innerWidth - 320));
const TOP = $derived(Math.min(Math.max(y, 8), window.innerHeight - 260));
// Position the dialog so its 16x16 arrow points at the click.
// Shift 8px left (arrow center lands on the click X via the 50% translate)
// and 16px down (bubble body sits under the arrow tip at the click Y).
const ARROW_X = 8;
const ARROW_Y = 16;
const LEFT = $derived(Math.min(Math.max(x - ARROW_X, 8), window.innerWidth - 320));
const TOP = $derived(Math.min(Math.max(y + ARROW_Y, 8), window.innerHeight - 260));
function save() {
onSavePoint(label.trim() ? label.trim() : undefined);