diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e4228..2c14a1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.3.43] - 2024.12.30 +## [0.3.44] - 2024.12.31 ### Added - Project counts on a map diff --git a/package-lock.json b/package-lock.json index 23c64c0..eba9f9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "TimeSafari", - "version": "0.3.43", + "version": "0.3.44", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "TimeSafari", - "version": "0.3.43", + "version": "0.3.44", "dependencies": { "@capacitor/android": "^6.1.2", "@capacitor/cli": "^6.1.2", diff --git a/package.json b/package.json index 218df9d..56902fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "TimeSafari", - "version": "0.3.43", + "version": "0.3.44", "scripts": { "dev": "vite", "serve": "vite preview", diff --git a/src/views/DiscoverView.vue b/src/views/DiscoverView.vue index ba718f1..3bff056 100644 --- a/src/views/DiscoverView.vue +++ b/src/views/DiscoverView.vue @@ -121,10 +121,9 @@
@@ -498,12 +497,18 @@ 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 + map.setView([this.localCenterLat, this.localCenterLong], 2); this.requestTiles(map); } // Tried but failed to use other vue-leaflet methods update:zoom and update:bounds // To access the from this.$refs, use this.$refs.projectMap.mapObject + onMoveStart(/* event: L.LocationEvent */) { + // don't remove markers because they follow the map when moving (and the experience is jarring) + } + async onMoveEnd(event: L.LocationEvent) { if (this.zoomedSoDoNotMove) { // since a zoom triggers a moveend, too, don't duplicate a tile request @@ -514,14 +519,18 @@ export default class DiscoverView extends Vue { } } - async onZoomEnd(event: L.LocationEvent) { - await this.requestTiles(event.target); - } - onZoomStart(/* event: L.LocationEvent */) { + // remove markers because otherwise they jump around at zoom end + Object.values(this.markers).forEach((marker) => marker.remove()); + this.markers = {}; + this.zoomedSoDoNotMove = true; } + async onZoomEnd(event: L.LocationEvent) { + await this.requestTiles(event.target); + } + async requestTiles(targetMap: L.Map) { try { const bounds = targetMap.getBounds(); @@ -535,10 +544,10 @@ export default class DiscoverView extends Vue { this.apiServer + "/api/v2/report/planCountsByBBox?" + queryParams, ); if (response.status === 200) { + Object.values(this.markers).forEach((marker) => marker.remove()); + this.markers = {}; const results = await response.json(); if (results.data?.tiles?.length > 0) { - Object.values(this.markers).forEach((marker) => marker.remove()); - this.markers = {}; for (const tile of results.data.tiles) { const pinLat = (tile.minFoundLat + tile.maxFoundLat) / 2; const pinLon = (tile.minFoundLon + tile.maxFoundLon) / 2; @@ -560,9 +569,7 @@ export default class DiscoverView extends Vue { }; this.searchLocal(); }); - this.markers[ - "" + tile.indexLat + "X" + tile.indexLon + "*" + tile.recordCount - ] = marker; + this.markers["" + tile.indexLat + "X" + tile.indexLon] = marker; } } await this.searchLocal(); @@ -664,6 +671,7 @@ export default class DiscoverView extends Vue { display: flex; align-items: center; justify-content: center; + text-align: center; font-size: 14px; font-weight: bold; color: white;