From c37f794eeaaae6ec625a4fd02c84f4fbceb13f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 10 Feb 2026 17:18:59 +0400 Subject: [PATCH 1/5] Auto-locate user on first app launch closes #17 --- app/components/map.gjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/components/map.gjs b/app/components/map.gjs index 8545e77..ed5309e 100644 --- a/app/components/map.gjs +++ b/app/components/map.gjs @@ -68,6 +68,7 @@ export default class MapComponent extends Component { // Default view settings let center = [14.21683569, 27.060114248]; let zoom = 2.661; + let restoredFromStorage = false; // Try to restore from localStorage try { @@ -82,6 +83,7 @@ export default class MapComponent extends Component { ) { center = parsed.center; zoom = parsed.zoom; + restoredFromStorage = true; } } } catch (e) { @@ -243,6 +245,7 @@ export default class MapComponent extends Component { const coordinates = geolocation.getPosition(); const accuracyGeometry = geolocation.getAccuracyGeometry(); const accuracy = geolocation.getAccuracy(); + console.debug('Geolocation change:', { coordinates, accuracy }); if (!coordinates) return; @@ -307,7 +310,8 @@ export default class MapComponent extends Component { this.mapInstance.getView().animate(viewOptions); }; - locateBtn.addEventListener('click', () => { + const startLocating = () => { + console.debug('Getting current geolocation...') // 1. Clear any previous session stopLocating(); @@ -331,7 +335,9 @@ export default class MapComponent extends Component { locateTimeout = setTimeout(() => { stopLocating(); }, 10000); - }); + }; + + locateBtn.addEventListener('click', startLocating); const locateControl = new Control({ element: locateElement, @@ -340,6 +346,11 @@ export default class MapComponent extends Component { this.mapInstance.addLayer(geolocationLayer); this.mapInstance.addControl(locateControl); + // Auto-locate on first visit (if not restored from storage and on home page) + if (!restoredFromStorage && this.router.currentRouteName === 'index') { + startLocating(); + } + this.mapInstance.on('singleclick', this.handleMapClick); // Load places when map moves -- 2.25.1 From 53300b92f5743a3a36fe4e3564fcf13fc3a3fd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 10 Feb 2026 17:47:03 +0400 Subject: [PATCH 2/5] Re-add zoom controls --- app/components/map.gjs | 2 +- app/styles/app.css | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/components/map.gjs b/app/components/map.gjs index ed5309e..1f66900 100644 --- a/app/components/map.gjs +++ b/app/components/map.gjs @@ -101,7 +101,7 @@ export default class MapComponent extends Component { layers: [openfreemap, bookmarkLayer], view: view, controls: defaultControls({ - zoom: false, + zoom: true, rotate: true, attribution: true, }), diff --git a/app/styles/app.css b/app/styles/app.css index 41cca5a..e88c567 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -539,22 +539,40 @@ body { } } -/* Locate Control */ +/* Zoom Control - Moved to bottom right above attribution */ +.ol-zoom { + top: auto !important; + left: auto !important; + bottom: 2.5em; + right: 0.5em; +} + +.ol-touch .ol-zoom { + bottom: 3.5em; +} + +/* Locate Control - Above Zoom */ .ol-control.ol-locate { - inset: auto 0.5em 2.5em auto; + top: auto !important; + left: auto !important; + bottom: 6.5em; + right: 0.5em; } .ol-touch .ol-control.ol-locate { - inset: auto 0.5em 3.5em auto; + bottom: 8.5em; } -/* Rotate Control */ +/* Rotate Control - Above Locate */ .ol-rotate { - inset: auto 0.5em 5em auto; + top: auto !important; + left: auto !important; + bottom: 9em; + right: 0.5em; } .ol-touch .ol-rotate { - inset: auto 0.5em 6em auto; + bottom: 11.5em; } span.icon { -- 2.25.1 From d30375707af0489e5aea450f6e7bcd0990ec12b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 10 Feb 2026 18:33:25 +0400 Subject: [PATCH 3/5] Prevent map search when zoomed out too much It's usually an accidental click, and if not, the search radius/pulse wouldn't be clearly visible. --- app/components/map.gjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/components/map.gjs b/app/components/map.gjs index 1f66900..2bcbfc4 100644 --- a/app/components/map.gjs +++ b/app/components/map.gjs @@ -744,6 +744,13 @@ export default class MapComponent extends Component { return; } + // Require Zoom >= 17 for generic map searches + // This prevents accidental searches when interacting with the map at a high level + const currentZoom = this.mapInstance.getView().getZoom(); + if (currentZoom < 16) { + return; + } + const coords = toLonLat(event.coordinate); const [lon, lat] = coords; -- 2.25.1 From ccaa56b78f72c1663a3f0394de5a1e789f5965a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 10 Feb 2026 18:44:31 +0400 Subject: [PATCH 4/5] Remove remaining default tap highlights on mobiles --- app/styles/app.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/styles/app.css b/app/styles/app.css index e88c567..fd42e3a 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -5,6 +5,11 @@ body { height: 100%; overscroll-behavior: none; /* Prevent pull-to-refresh on mobile */ -webkit-text-size-adjust: 100%; + -webkit-tap-highlight-color: transparent; +} + +button { + -webkit-tap-highlight-color: transparent; } body { -- 2.25.1 From 55aecbd69930c4c6f63019f7d0f7a4d41d895dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 10 Feb 2026 18:51:26 +0400 Subject: [PATCH 5/5] Apply same button-press effect to both header buttons --- app/components/app-header.gjs | 4 ++-- app/styles/app.css | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/components/app-header.gjs b/app/components/app-header.gjs index 48966a6..baad34a 100644 --- a/app/components/app-header.gjs +++ b/app/components/app-header.gjs @@ -24,7 +24,7 @@ export default class AppHeaderComponent extends Component {