diff --git a/package/src/store/actions.ts b/package/src/store/actions.ts index 62c9d5b1..e9541359 100644 --- a/package/src/store/actions.ts +++ b/package/src/store/actions.ts @@ -103,12 +103,7 @@ const createGraphNodes = (nodes: Node[], getNode: Getters['getNode'], currGraphN if (node.parentNode && !nextNodes.find((n) => n.id === node.parentNode)) { console.warn(`[vueflow]: Parent node ${node.parentNode} not found`) } - const position = - (node).position instanceof Function - ? (node).position(node, currGraphNodes, node.parentNode ? getNode(node.parentNode) : undefined) - : node.position - if (position) node.position = position if (node.parentNode || parentNodes[node.id]) { if (parentNodes[node.id]) { node.isParent = true diff --git a/package/src/types/node.ts b/package/src/types/node.ts index ce83ad22..370487cb 100644 --- a/package/src/types/node.ts +++ b/package/src/types/node.ts @@ -10,17 +10,12 @@ export type NodeHandleBounds = { target?: HandleElement[] } -type PositionFunc = ( - node: GraphNode, - currNodes: GraphNode[], - parentNode: GraphNode, -) => XYPosition type WidthFunc = (node: GraphNode) => number | string | void type HeightFunc = (node: GraphNode) => number | string | void export interface Node extends Element { /** initial node position x, y */ - position: XYPosition | PositionFunc + position: XYPosition /** node type, can be a default type or a custom type */ type?: keyof DefaultNodeTypes | string /** handle position */ @@ -60,8 +55,6 @@ export interface Node extends Element { } export interface GraphNode extends Node { - /** current node position x, y */ - position: XYPosition /** absolute position in relation to parent elements + z-index */ computedPosition: XYZPosition handleBounds: NodeHandleBounds