refactor(core): remove extent option for setNodes & addNodes
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -69,7 +69,7 @@ export const isGraphNode = <Data = ElementData>(element: MaybeElement): element
|
||||
|
||||
export const isRect = (obj: any): obj is Rect => !!obj.width && !!obj.height && !!obj.x && !!obj.y
|
||||
|
||||
export const parseNode = (node: Node, nodeExtent: CoordinateExtent, defaults?: Partial<GraphNode>): GraphNode => {
|
||||
export const parseNode = (node: Node, defaults?: Partial<GraphNode>): GraphNode => {
|
||||
let defaultValues = defaults
|
||||
if (!isGraphNode(node)) {
|
||||
defaultValues = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Actions, Connection, CoordinateExtent, Edge, GraphEdge, GraphNode, Node } from '~/types'
|
||||
import type { Actions, Connection, Edge, GraphEdge, GraphNode, Node } from '~/types'
|
||||
|
||||
export const isDef = <T>(val: T): val is NonNullable<T> => typeof unref(val) !== 'undefined'
|
||||
|
||||
@@ -49,16 +49,11 @@ export const updateEdgeAction = (edge: GraphEdge, newConnection: Connection, edg
|
||||
return newEdge
|
||||
}
|
||||
|
||||
export const createGraphNodes = (
|
||||
nodes: Node[],
|
||||
findNode: Actions['findNode'],
|
||||
currGraphNodes: GraphNode[],
|
||||
extent: CoordinateExtent,
|
||||
) => {
|
||||
export const createGraphNodes = (nodes: Node[], findNode: Actions['findNode'], currGraphNodes: GraphNode[]) => {
|
||||
const parentNodes: Record<string, true> = {}
|
||||
|
||||
const graphNodes = nodes.map((node) => {
|
||||
const parsed = parseNode(node, extent, {
|
||||
const parsed = parseNode(node, {
|
||||
...findNode(node.id),
|
||||
parentNode: node.parentNode,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user