Browse Source

fix a jump on user profile map move & recenter

pull/124/head
Trent Larson 2 weeks ago
parent
commit
0576fc4187
  1. 4
      src/router/index.ts
  2. 11
      src/views/AccountViewView.vue
  3. 2
      src/views/DiscoverView.vue

4
src/router/index.ts

@ -279,9 +279,7 @@ const errorHandler = (
) => { ) => {
// Handle the error here // Handle the error here
console.error("Caught in top level error handler:", error, to, from); console.error("Caught in top level error handler:", error, to, from);
alert( alert("Something is very wrong. Try reloading or restarting the app.");
"Something is very wrong. We'd love if you contacted us and let us know how you got here. Thank you!",
);
// You can also perform additional actions, such as displaying an error message or redirecting the user to a specific page // You can also perform additional actions, such as displaying an error message or redirecting the user to a specific page
}; };

11
src/views/AccountViewView.vue

@ -302,9 +302,7 @@
</p> </p>
<l-map <l-map
ref="map" ref="profileMap"
v-model:zoom="zoom"
:center="[userProfileLatitude, userProfileLongitude]"
class="!z-40 rounded-md" class="!z-40 rounded-md"
@click=" @click="
(event: LeafletMouseEvent) => { (event: LeafletMouseEvent) => {
@ -312,6 +310,7 @@
userProfileLongitude = event.latlng.lng; userProfileLongitude = event.latlng.lng;
} }
" "
@ready="onMapReady"
> >
<l-tile-layer <l-tile-layer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" 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() { showProfileInfo() {
this.$notify( this.$notify(
{ {

2
src/views/DiscoverView.vue

@ -619,7 +619,7 @@ export default class DiscoverView extends Vue {
} }
async onMapReady(map: L.Map) { 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); map.setView([this.localCenterLat, this.localCenterLong], 2);
this.requestTiles(map); this.requestTiles(map);
} }

Loading…
Cancel
Save