fix a jump on user profile map move & recenter
This commit is contained in:
@@ -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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user