forked from jsnbuchanan/crowd-funder-for-time-pwa
fix a jump on user profile map move & recenter
This commit is contained in:
@@ -279,9 +279,7 @@ const errorHandler = (
|
||||
) => {
|
||||
// Handle the error here
|
||||
console.error("Caught in top level error handler:", error, to, from);
|
||||
alert(
|
||||
"Something is very wrong. We'd love if you contacted us and let us know how you got here. Thank you!",
|
||||
);
|
||||
alert("Something is very wrong. Try reloading or restarting the app.");
|
||||
|
||||
// You can also perform additional actions, such as displaying an error message or redirecting the user to a specific page
|
||||
};
|
||||
|
||||
@@ -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(
|
||||
{
|
||||
|
||||
@@ -619,7 +619,7 @@ export default class DiscoverView extends Vue {
|
||||
}
|
||||
|
||||
async onMapReady(map: L.Map) {
|
||||
// doing this here instead of the l-map element avoids a recentering after the first drag
|
||||
// doing this here instead of on the l-map element avoids a recentering after a drag then zoom at startup
|
||||
map.setView([this.localCenterLat, this.localCenterLong], 2);
|
||||
this.requestTiles(map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user