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 @@
-
+
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({