Move map as bounds change on communication workspace
This commit is contained in:
parent
4fcb184286
commit
4ed005fb37
1 changed files with 22 additions and 0 deletions
|
|
@ -245,6 +245,28 @@ onBeforeUnmount(() => {
|
|||
map.value.remove();
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => props.bounds,
|
||||
(newBounds) => {
|
||||
if (!map.value) return;
|
||||
if (map.value.loaded()) {
|
||||
map.value.fitBounds(
|
||||
newBounds,
|
||||
{ padding: 50, duration: 1000 },
|
||||
{ isInternalUpdate: true },
|
||||
);
|
||||
} else {
|
||||
map.value.once("load", () => {
|
||||
if (!map.value) return;
|
||||
map.value.fitBounds(
|
||||
newBounds,
|
||||
{ padding: 50, duration: 0 },
|
||||
{ isInternalUpdate: true },
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
watch(
|
||||
() => props.cursor,
|
||||
(newCursor) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue