Skip to content

Commit

Permalink
Zoomto support polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Aug 9, 2024
1 parent f4ea532 commit 0b94555
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions api/web/src/components/CloudTAK/CoTView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ export default {
await this.fetchType();
}
},
unmounted: async function() {
if (this.feat) await cotStore.add(this.feat);
},
computed: {
...mapState(useProfileStore, ['profile']),
isUserDrawn: function() {
Expand Down Expand Up @@ -403,10 +400,27 @@ export default {
this.$router.push('/');
},
zoomTo: function() {
mapStore.map.flyTo({
center: this.center,
zoom: 14
})
if (this.feat.geometry.type === "Point") {
const flyTo = {
speed: Infinity,
center: this.feat.properties.center,
zoom: 14
};
if (mapStore.map.getZoom() < 3) flyTo.zoom = 4;
mapStore.map.flyTo(flyTo)
} else {
mapStore.map.fitBounds(this.feat.bounds(), {
maxZoom: 14,
padding: {
top: 20,
bottom: 20,
left: 20,
right: 20
},
speed: Infinity,
})
}
}
},
components: {
Expand Down

0 comments on commit 0b94555

Please sign in to comment.