fix(core): check if viewport is defined before setting
This commit is contained in:
@@ -844,14 +844,18 @@ export function useActions(
|
|||||||
setEdges(edges)
|
setEdges(edges)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewport || position) {
|
if ((viewport?.x && viewport?.y) || position) {
|
||||||
|
const x = viewport?.x || position[0]
|
||||||
|
const y = viewport?.y || position[1]
|
||||||
|
const nextZoom = viewport?.zoom || zoom || state.viewport.zoom
|
||||||
|
|
||||||
until(() => viewportHelper.value.initialized)
|
until(() => viewportHelper.value.initialized)
|
||||||
.toBe(true)
|
.toBe(true)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
viewportHelper.value.setViewport({
|
viewportHelper.value.setViewport({
|
||||||
x: viewport.x || position[0],
|
x,
|
||||||
y: viewport.y || position[1],
|
y,
|
||||||
zoom: viewport.zoom || zoom || state.viewport.zoom,
|
zoom: nextZoom,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user