Zoom when an address is provided or the map is clicked
This commit is contained in:
parent
c5c78a2b84
commit
07e48aa071
2 changed files with 32 additions and 12 deletions
|
|
@ -533,11 +533,35 @@ const markers = computed((): Marker[] => {
|
|||
});
|
||||
function doAddressSelected(address: Address) {
|
||||
console.log("Address selected", address);
|
||||
const geom = address.geometry;
|
||||
if (!geom) {
|
||||
console.error("No geometry on address", address);
|
||||
return;
|
||||
}
|
||||
marker.value = {
|
||||
color: "#FF0000",
|
||||
draggable: true,
|
||||
id: "x",
|
||||
location: {
|
||||
lat: geom.coordinates[1],
|
||||
lng: geom.coordinates[0],
|
||||
},
|
||||
};
|
||||
}
|
||||
function doMapClick(location: Location) {
|
||||
console.log("Map clicked", location);
|
||||
marker.value = {
|
||||
color: "#FF0000",
|
||||
draggable: true,
|
||||
id: "x",
|
||||
location: location,
|
||||
};
|
||||
}
|
||||
function doMapMarkerDragEnd(location: Location) {
|
||||
console.log("marker drag end", location);
|
||||
marker.value = {
|
||||
color: "#FF0000",
|
||||
draggable: true,
|
||||
id: "x",
|
||||
location: location,
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue