From d22ecd13f98f22f0ee4566451078325ad770d00c Mon Sep 17 00:00:00 2001 From: Ivan Date: Thu, 23 Apr 2026 14:29:00 -0500 Subject: [PATCH] feat(map): update map functionality with north indicator rotation and responsive scale line visibility --- .../src/frontend/components/map/MapPage.vue | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/meshchatx/src/frontend/components/map/MapPage.vue b/meshchatx/src/frontend/components/map/MapPage.vue index be586e1..5b01907 100644 --- a/meshchatx/src/frontend/components/map/MapPage.vue +++ b/meshchatx/src/frontend/components/map/MapPage.vue @@ -420,8 +420,9 @@ - +
- N - +
+ N + +
0); }, @@ -1546,11 +1560,25 @@ export default { settingsEl.style.willChange = ""; } if (this.map) { + const v = this.map.getView(); + if (v && typeof v.un === "function") { + v.un("change:rotation", this.syncMapNorthIndicatorFromViewRotation); + } this.map.setTarget(null); this.map = null; } }, methods: { + syncMapNorthIndicatorFromViewRotation() { + if (!this.map) { + return; + } + const view = this.map.getView(); + if (!view || typeof view.getRotation !== "function") { + return; + } + this.mapViewRotationRad = view.getRotation(); + }, saveMapState() { if (!this._pendingSaveResolvers) { this._pendingSaveResolvers = []; @@ -1687,6 +1715,12 @@ export default { maxTilesLoading: 48, }); + const mapView = this.map.getView(); + if (mapView && typeof mapView.on === "function" && typeof mapView.getRotation === "function") { + mapView.on("change:rotation", this.syncMapNorthIndicatorFromViewRotation); + this.syncMapNorthIndicatorFromViewRotation(); + } + // setup drawing layer this.drawSource = new VectorSource(); this.drawLayer = new VectorLayer({