fix a jump on user profile map move & recenter

This commit is contained in:
2025-01-21 19:51:58 -07:00
parent b9fedcd3fd
commit 0576fc4187
3 changed files with 10 additions and 7 deletions

View File

@@ -302,9 +302,7 @@
</p>
<l-map
ref="map"
v-model:zoom="zoom"
:center="[userProfileLatitude, userProfileLongitude]"
ref="profileMap"
class="!z-40 rounded-md"
@click="
(event: LeafletMouseEvent) => {
@@ -312,6 +310,7 @@
userProfileLongitude = event.latlng.lng;
}
"
@ready="onMapReady"
>
<l-tile-layer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
@@ -1797,6 +1796,12 @@ export default class AccountViewView extends Vue {
}
}
onMapReady(map: L.Map) {
// doing this here instead of on the l-map element avoids a recentering after a drag then zoom at startup
const zoom = this.userProfileLatitude && this.userProfileLongitude ? 12 : 2;
map.setView([this.userProfileLatitude, this.userProfileLongitude], zoom);
}
showProfileInfo() {
this.$notify(
{