diff --git a/examples/Provider/Sidebar.vue b/examples/Provider/Sidebar.vue
index 023a5707..fa81ef79 100644
--- a/examples/Provider/Sidebar.vue
+++ b/examples/Provider/Sidebar.vue
@@ -19,7 +19,7 @@ const selectAll = () => {
{{ [transform[0].toFixed(2), transform[1].toFixed(2), transform[2].toFixed(2)] }}
Nodes
- Node {{ node.id }} - x: {{ node.__rf.position.x.toFixed(2) }}, y: {{ node.__rf.position.y.toFixed(2) }}
+ Node {{ node.id }} - x: {{ node.__vf.position.x.toFixed(2) }}, y: {{ node.__vf.position.y.toFixed(2) }}
diff --git a/src/additional-components/MiniMap/MiniMap.vue b/src/additional-components/MiniMap/MiniMap.vue
index 3d0b23df..604fac61 100644
--- a/src/additional-components/MiniMap/MiniMap.vue
+++ b/src/additional-components/MiniMap/MiniMap.vue
@@ -92,10 +92,10 @@ const d = computed(() => {
>
{
:shape-rendering="shapeRendering"
>
d.id === store.connectionHandleId,
)
- : store.connectionHandleType && props.sourceNode.__rf?.handleBounds[store.connectionHandleType ?? 'source'][0]
-const sourceHandleX = sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : (props.sourceNode.__rf?.width as number) / 2
-const sourceHandleY = sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : props.sourceNode.__rf?.height
-const sourceX = props.sourceNode.__rf?.position?.x + sourceHandleX
-const sourceY = props.sourceNode.__rf?.position?.y + sourceHandleY
+ : store.connectionHandleType && props.sourceNode.__vf?.handleBounds[store.connectionHandleType ?? 'source'][0]
+const sourceHandleX = sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : (props.sourceNode.__vf?.width as number) / 2
+const sourceHandleY = sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : props.sourceNode.__vf?.height
+const sourceX = props.sourceNode.__vf?.position?.x + sourceHandleX
+const sourceY = props.sourceNode.__vf?.position?.y + sourceHandleY
const isRightOrLeft = sourceHandle.position === Position.Left || sourceHandle.position === Position.Right
const targetPosition = isRightOrLeft ? Position.Left : Position.Top
diff --git a/src/components/Edges/Edge.vue b/src/components/Edges/Edge.vue
index 1a754633..b51dd850 100644
--- a/src/components/Edges/Edge.vue
+++ b/src/components/Edges/Edge.vue
@@ -102,12 +102,12 @@ const nodes = computed(() => {
// when connection type is loose we can define all handles as sources
const targetNodeHandles = computed(() =>
store.connectionMode === ConnectionMode.Strict
- ? nodes.value.targetNode?.__rf?.handleBounds.target
- : nodes.value.targetNode?.__rf?.handleBounds.target ?? nodes.value.targetNode?.__rf?.handleBounds.source,
+ ? nodes.value.targetNode?.__vf?.handleBounds.target
+ : nodes.value.targetNode?.__vf?.handleBounds.target ?? nodes.value.targetNode?.__vf?.handleBounds.source,
)
const sourceHandle = computed(() => {
- if (nodes.value.sourceNode) return getHandle(nodes.value.sourceNode.__rf?.handleBounds.source, props.edge.sourceHandle ?? null)
+ if (nodes.value.sourceNode) return getHandle(nodes.value.sourceNode.__vf?.handleBounds.source, props.edge.sourceHandle ?? null)
else return null
})
const targetHandle = computed(() => getHandle(targetNodeHandles.value, props.edge.targetHandle ?? null))
diff --git a/src/components/Nodes/Node.vue b/src/components/Nodes/Node.vue
index 8887c340..e3f925fb 100644
--- a/src/components/Nodes/Node.vue
+++ b/src/components/Nodes/Node.vue
@@ -41,13 +41,13 @@ const scale = computed(() => store.transform[2])
const selected = computed(() => selectable.value && store.selectedElements?.some(({ id }) => id === props.node.id))
const onMouseEnterHandler = () =>
- props.node.__rf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseEnter.trigger({ event, node: props.node }))
+ props.node.__vf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseEnter.trigger({ event, node: props.node }))
const onMouseMoveHandler = () =>
- props.node.__rf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseMove.trigger({ event, node: props.node }))
+ props.node.__vf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseMove.trigger({ event, node: props.node }))
const onMouseLeaveHandler = () =>
- props.node.__rf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseLeave.trigger({ event, node: props.node }))
+ props.node.__vf?.isDragging && ((event: MouseEvent) => store.hooks.nodeMouseLeave.trigger({ event, node: props.node }))
const onContextMenuHandler = () => (event: MouseEvent) => store.hooks.nodeContextMenu.trigger({ event, node: props.node })
@@ -97,7 +97,7 @@ const onDragStop: DraggableEventListener = ({ event }) => {
const n = props.node
// onDragStop also gets called when user just clicks on a node.
// Because of that we set dragging to true inside the onDrag handler and handle the click here
- if (!props.node.__rf?.isDragging) {
+ if (!props.node.__vf?.isDragging) {
if (selectable.value && !props.selectNodesOnDrag && !selected.value) {
store.addSelectedElements([n])
}
@@ -165,9 +165,9 @@ onMounted(() => {
]"
:style="{
zIndex: selected ? 10 : 3,
- transform: `translate(${props.node.__rf?.position?.x}px,${props.node.__rf?.position?.y}px)`,
+ transform: `translate(${props.node.__vf?.position?.x}px,${props.node.__vf?.position?.y}px)`,
pointerEvents: selectable || draggable ? 'all' : 'none',
- opacity: props.node.__rf?.width !== null && props.node.__rf?.height !== null ? 1 : 0,
+ opacity: props.node.__vf?.width !== null && props.node.__vf?.height !== null ? 1 : 0,
...props.node.style,
}"
:data-id="props.node.id"
@@ -182,13 +182,13 @@ onMounted(() => {
id: props.node.id,
data: props.node.data,
type: props.node.type,
- xPos: props.node.__rf?.position?.x,
- yPos: props.node.__rf?.position?.y,
+ xPos: props.node.__vf?.position?.x,
+ yPos: props.node.__vf?.position?.y,
selected,
connectable,
sourcePosition: props.node.sourcePosition,
targetPosition: props.node.targetPosition,
- dragging: props.node.__rf?.isDragging,
+ dragging: props.node.__vf?.isDragging,
}"
>
{
id: props.node.id,
data: props.node.data,
type: props.node.type,
- xPos: props.node.__rf?.position?.x,
- yPos: props.node.__rf?.position?.y,
+ xPos: props.node.__vf?.position?.x,
+ yPos: props.node.__vf?.position?.y,
selected,
connectable,
sourcePosition: props.node.sourcePosition,
targetPosition: props.node.targetPosition,
- dragging: props.node.__rf?.isDragging,
+ dragging: props.node.__vf?.isDragging,
}"
/>
diff --git a/src/components/NodesSelection/NodesSelection.vue b/src/components/NodesSelection/NodesSelection.vue
index 87193fc2..aaa8a61b 100644
--- a/src/components/NodesSelection/NodesSelection.vue
+++ b/src/components/NodesSelection/NodesSelection.vue
@@ -12,7 +12,7 @@ const selectedNodes = store.selectedElements
return {
...matchingNode,
- position: matchingNode?.__rf?.position,
+ position: matchingNode?.__vf?.position,
} as Node
})
: []
diff --git a/src/container/EdgeRenderer/utils.ts b/src/container/EdgeRenderer/utils.ts
index 55cb53c1..c166590e 100644
--- a/src/container/EdgeRenderer/utils.ts
+++ b/src/container/EdgeRenderer/utils.ts
@@ -2,10 +2,10 @@ import { Edge, EdgePositions, ElementId, HandleElement, Node, Position, Transfor
import { rectToBox } from '~/utils'
export function getHandlePosition(position: Position, node: Node, handle: any | null = null): XYPosition {
- const x = (handle?.x || 0) + node.__rf?.position?.x
- const y = (handle?.y || 0) + node.__rf?.position?.y
- const width = handle?.width || node.__rf?.width
- const height = handle?.height || node.__rf?.height
+ const x = (handle?.x || 0) + node.__vf?.position?.x
+ const y = (handle?.y || 0) + node.__vf?.position?.y
+ const width = handle?.width || node.__vf?.width
+ const height = handle?.height || node.__vf?.height
switch (position) {
case Position.Top:
diff --git a/src/store/stateStore.ts b/src/store/stateStore.ts
index ba592dae..b2b91a76 100644
--- a/src/store/stateStore.ts
+++ b/src/store/stateStore.ts
@@ -91,19 +91,19 @@ export default function flowStore(
const node = this.nodes[i]
const dimensions = getDimensions(nodeElement)
- if (!node.__rf) node.__rf = {}
+ if (!node.__vf) node.__vf = {}
const doUpdate =
dimensions.width &&
dimensions.height &&
- (node.__rf.width !== dimensions.width || node.__rf.height !== dimensions.height || forceUpdate)
+ (node.__vf.width !== dimensions.width || node.__vf.height !== dimensions.height || forceUpdate)
if (doUpdate) {
const handleBounds = getHandleBounds(nodeElement, this.transform[2])
this.nodes.splice(i, 1, {
...node,
- __rf: {
- ...node.__rf,
+ __vf: {
+ ...node.__vf,
...dimensions,
handleBounds,
},
@@ -124,8 +124,8 @@ export default function flowStore(
this.nodes.splice(i, 1, {
...node,
- __rf: {
- ...node.__rf,
+ __vf: {
+ ...node.__vf,
position: pos,
},
})
@@ -134,16 +134,16 @@ export default function flowStore(
const update = (node: Node, i: number) => {
const updatedNode = {
...node,
- __rf: {
- ...node.__rf,
+ __vf: {
+ ...node.__vf,
isDragging,
},
}
if (diff) {
- updatedNode.__rf.position = {
- x: (node.__rf?.position?.x as number) + diff.x,
- y: (node.__rf?.position?.y as number) + diff.y,
+ updatedNode.__vf.position = {
+ x: (node.__vf?.position?.x as number) + diff.x,
+ y: (node.__vf?.position?.y as number) + diff.y,
}
}
@@ -197,7 +197,7 @@ export default function flowStore(
this.selectedElements = nextSelectedElements
},
unsetUserSelection() {
- const selectedNodes = this.selectedElements?.filter((node) => node && isNode(node) && node.__rf) as Node[]
+ const selectedNodes = this.selectedElements?.filter((node) => node && isNode(node) && node.__vf) as Node[]
this.selectionActive = false
this.userSelectionRect.draw = false
@@ -237,9 +237,9 @@ export default function flowStore(
this.nodes = this.nodes.map((node) => {
return {
...node,
- __rf: {
- ...node.__rf,
- position: node.__rf?.position && clampPosition(node.__rf.position, nodeExtent),
+ __vf: {
+ ...node.__vf,
+ position: node.__vf?.position && clampPosition(node.__vf.position, nodeExtent),
},
}
})
diff --git a/src/store/utils.ts b/src/store/utils.ts
index bf918bf5..cb1b1e2c 100644
--- a/src/store/utils.ts
+++ b/src/store/utils.ts
@@ -109,16 +109,16 @@ export const parseElements = async (elements: Elements, nodes: Node[], edges: Ed
...storeNode,
...element,
}
- if (!updatedNode.__rf) updatedNode.__rf = {}
+ if (!updatedNode.__vf) updatedNode.__vf = {}
if (storeNode.position.x !== element.position.x || storeNode.position.y !== element.position.y) {
- updatedNode.__rf.position = element.position
+ updatedNode.__vf.position = element.position
}
if (typeof element.type !== 'undefined' && element.type !== storeNode.type) {
// we reset the elements dimensions here in order to force a re-calculation of the bounds.
// When the type of a node changes it is possible that the number or positions of handles changes too.
- updatedNode.__rf.width = undefined
+ updatedNode.__vf.width = undefined
}
nextElements.nextNodes.push(updatedNode)
diff --git a/src/types/node.ts b/src/types/node.ts
index 2b524c20..1b79804c 100644
--- a/src/types/node.ts
+++ b/src/types/node.ts
@@ -5,7 +5,7 @@ export interface Node {
id: ElementId
position: XYPosition
type?: string
- __rf?:
+ __vf?:
| {
position?: XYPosition
isDragging?: boolean
diff --git a/src/utils/graph.ts b/src/utils/graph.ts
index df37f528..6ccb31da 100644
--- a/src/utils/graph.ts
+++ b/src/utils/graph.ts
@@ -170,7 +170,7 @@ export const parseNode = (node: Node, nodeExtent: NodeExtent): Node => ({
...node,
id: node.id.toString(),
type: node.type || 'default',
- __rf: {
+ __vf: {
position: clampPosition(node.position, nodeExtent),
width: undefined,
height: undefined,
@@ -215,7 +215,7 @@ export const getBoundsofRects = (rect1: Rect, rect2: Rect): Rect =>
export const getRectOfNodes = (nodes: Node[]): Rect => {
const box = nodes.reduce(
- (currBox, { __rf: { position, width, height } = {} }) =>
+ (currBox, { __vf: { position, width, height } = {} }) =>
getBoundsOfBoxes(
currBox,
rectToBox({
@@ -244,8 +244,8 @@ export const getNodesInside = (nodes: Node[], rect: Rect, [tx, ty, tScale]: Tran
})
return nodes.filter((node) => {
- if (!node.__rf) return false
- const { position = { x: 0, y: 0 }, width = 0, height = 0, isDragging = false } = node.__rf
+ if (!node.__vf) return false
+ const { position = { x: 0, y: 0 }, width = 0, height = 0, isDragging = false } = node.__vf
const nBox = rectToBox({ ...position, width, height } as any)
const xOverlap = Math.max(0, Math.min(rBox.x2, nBox.x2) - Math.max(rBox.x, nBox.x))
const yOverlap = Math.max(0, Math.min(rBox.y2, nBox.y2) - Math.max(rBox.y, nBox.y))
diff --git a/src/workers/parseElements.ts b/src/workers/parseElements.ts
index 3acf3b0c..a3f86846 100644
--- a/src/workers/parseElements.ts
+++ b/src/workers/parseElements.ts
@@ -13,7 +13,7 @@ export default () =>
Object.assign(node, {
id: node.id.toString(),
type: node.type || 'default',
- __rf: {
+ __vf: {
position: clampPosition(node.position, nodeExtent),
width: undefined,
height: undefined,
@@ -49,16 +49,16 @@ export default () =>
if (storeNode) {
const updatedNode: Node = Object.assign(storeNode, element)
- if (!updatedNode.__rf) updatedNode.__rf = {}
+ if (!updatedNode.__vf) updatedNode.__vf = {}
if (storeNode.position.x !== element.position.x || storeNode.position.y !== element.position.y) {
- updatedNode.__rf.position = element.position
+ updatedNode.__vf.position = element.position
}
if (typeof element.type !== 'undefined' && element.type !== storeNode.type) {
// we reset the elements dimensions here in order to force a re-calculation of the bounds.
// When the type of a node changes it is possible that the number or positions of handles changes too.
- updatedNode.__rf.width = undefined
+ updatedNode.__vf.width = undefined
}
nextElements.nextNodes.push(updatedNode)