refactor(core): remove initialized from graph-nodes (#1457)

* refactor(core): remove `initialized` from graph-nodes

* chore(changeset): add

* refactor(node-resizer): replace node initialized check

* chore(changeset): add
This commit is contained in:
Braks
2024-06-13 00:04:51 +02:00
parent 9a7e4ac952
commit 0c5dfddc47
9 changed files with 30 additions and 20 deletions
+2 -7
View File
@@ -1,6 +1,5 @@
import { zoomIdentity } from 'd3-zoom'
import type { ComputedRef } from 'vue'
import { nextTick } from 'vue'
import { until } from '@vueuse/core'
import type {
Actions,
@@ -163,7 +162,6 @@ export function useActions(
node.dimensions = dimensions
node.handleBounds.source = getHandleBounds('.source', update.nodeElement, nodeBounds, zoom)
node.handleBounds.target = getHandleBounds('.target', update.nodeElement, nodeBounds, zoom)
node.initialized = true
changes[i] = {
id: node.id,
@@ -175,10 +173,8 @@ export function useActions(
}
if (!state.fitViewOnInitDone && state.fitViewOnInit) {
nextTick(() => {
viewportHelper.value.fitView()
state.fitViewOnInitDone = true
})
viewportHelper.value.fitView()
state.fitViewOnInitDone = true
}
if (changes.length) {
@@ -813,7 +809,6 @@ export function useActions(
isParent: _____,
resizing: ______,
dragging: _______,
initialized: ________,
events: _________,
...rest
} = node
+1 -1
View File
@@ -134,7 +134,7 @@ export function useGetters(
const initializedNodes: GraphNode[] = []
for (const node of state.nodes) {
if (node.initialized && node.handleBounds !== undefined) {
if (!!node.dimensions.width && !!node.dimensions.height && node.handleBounds !== undefined) {
initializedNodes.push(node)
}
}