fix: watch translate extent separately
This commit is contained in:
@@ -144,6 +144,20 @@ export default (models: ToRefs<Pick<FlowProps, 'nodes' | 'edges' | 'modelValue'>
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const watchTranslateExtent = () => {
|
||||||
|
scope.run(() => {
|
||||||
|
watch(
|
||||||
|
() => props.translateExtent,
|
||||||
|
() => {
|
||||||
|
if (props.translateExtent && isDef(props.translateExtent)) {
|
||||||
|
store.setTranslateExtent(props.translateExtent)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: isDef(props.translateExtent) },
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const watchApplyDefault = () => {
|
const watchApplyDefault = () => {
|
||||||
scope.run(() => {
|
scope.run(() => {
|
||||||
watch(
|
watch(
|
||||||
@@ -220,7 +234,7 @@ export default (models: ToRefs<Pick<FlowProps, 'nodes' | 'edges' | 'modelValue'>
|
|||||||
}
|
}
|
||||||
|
|
||||||
const watchRest = () => {
|
const watchRest = () => {
|
||||||
const skip = ['id', 'modelValue', 'edges', 'nodes', 'maxZoom', 'minZoom', 'applyDefault', 'autoConnect']
|
const skip = ['id', 'modelValue', 'translateExtent', 'edges', 'nodes', 'maxZoom', 'minZoom', 'applyDefault', 'autoConnect']
|
||||||
Object.keys(props).forEach((prop) => {
|
Object.keys(props).forEach((prop) => {
|
||||||
if (!skip.includes(prop)) {
|
if (!skip.includes(prop)) {
|
||||||
const model = props[prop as keyof typeof props]
|
const model = props[prop as keyof typeof props]
|
||||||
@@ -247,6 +261,7 @@ export default (models: ToRefs<Pick<FlowProps, 'nodes' | 'edges' | 'modelValue'>
|
|||||||
watchEdgesValue,
|
watchEdgesValue,
|
||||||
watchMinZoom,
|
watchMinZoom,
|
||||||
watchMaxZoom,
|
watchMaxZoom,
|
||||||
|
watchTranslateExtent,
|
||||||
watchApplyDefault,
|
watchApplyDefault,
|
||||||
watchAutoConnect,
|
watchAutoConnect,
|
||||||
watchRest,
|
watchRest,
|
||||||
|
|||||||
Reference in New Issue
Block a user