fix(core): abort fit view when there's no nodes to fit around
This commit is contained in:
@@ -85,10 +85,6 @@ export function useViewport(state: State, getters: ComputedGetters) {
|
||||
duration: 0,
|
||||
},
|
||||
) => {
|
||||
if (!nodes.length) {
|
||||
return
|
||||
}
|
||||
|
||||
const nodesToFit: GraphNode[] = (options.includeHiddenNodes ? nodes : getNodes.value).filter((node) => {
|
||||
const initialized = node.initialized && node.dimensions.width && node.dimensions.height
|
||||
let shouldInclude = true
|
||||
@@ -100,6 +96,10 @@ export function useViewport(state: State, getters: ComputedGetters) {
|
||||
return initialized && shouldInclude
|
||||
})
|
||||
|
||||
if (!nodesToFit.length) {
|
||||
return
|
||||
}
|
||||
|
||||
const bounds = getRectOfNodes(nodesToFit)
|
||||
|
||||
const { x, y, zoom } = getTransformForBounds(
|
||||
|
||||
Reference in New Issue
Block a user