Skip to content

Commit

Permalink
fix(react): connectionline example
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Jul 30, 2024
1 parent 8dfcd82 commit a15748c
Show file tree
Hide file tree
Showing 8 changed files with 840 additions and 554 deletions.
1,368 changes: 826 additions & 542 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sites/reactflow.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@typeform/embed-react": "^3.9.0",
"@types/d3-force": "^3.0.9",
"@types/three": "^0.155.1",
"@xyflow/react": "^12.0.0",
"@xyflow/react": "^12.0.4",
"@xyflow/xy-ui": "workspace:*",
"clsx": "^1.2.1",
"d3": "^7.9.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react';
import { useConnection } from '@xyflow/react';

export default ({ fromX, fromY, toX, toY }) => {
const { startHandle } = useConnection();
const { fromHandle } = useConnection();

return (
<g>
<path
fill="none"
stroke={startHandle.handleId}
stroke={fromHandle.id}
strokeWidth={1.5}
className="animated"
d={`M${fromX},${fromY} C ${fromX} ${toY} ${fromX} ${toY} ${toX},${toY}`}
Expand All @@ -18,7 +18,7 @@ export default ({ fromX, fromY, toX, toY }) => {
cy={toY}
fill="#fff"
r={3}
stroke={startHandle.handleId}
stroke={fromHandle.id}
strokeWidth={1.5}
/>
</g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ function FloatingConnectionLine({

const targetNode = {
id: 'connection-target',
width: 1,
height: 1,
positionAbsolute: { x: toX, y: toY },
measured: {
width: 1,
height: 1,
},
internals: {
positionAbsolute: { x: toX, y: toY },
},
};

const { sx, sy } = getEdgeParams(fromNode, targetNode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useCallback } from 'react';
import { useStore, getBezierPath, useInternalNode } from '@xyflow/react';
import { getBezierPath, useInternalNode } from '@xyflow/react';

import { getEdgeParams } from './utils.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const edgeTypes = {
const NodeAsHandleFlow = () => {
const [nodes, , onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);

const onConnect = useCallback(
(params) =>
setEdges((eds) =>
Expand Down
2 changes: 1 addition & 1 deletion sites/svelteflow.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@react-three/fiber": "^8.13.7",
"@stackblitz/sdk": "^1.9.0",
"@types/three": "^0.155.1",
"@xyflow/react": "12.0.0",
"@xyflow/react": "12.0.4",
"@xyflow/svelte": "0.1.10",
"@xyflow/xy-ui": "workspace:*",
"clsx": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion sites/xyflow.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@react-three/fiber": "^8.13.7",
"@stackblitz/sdk": "^1.9.0",
"@types/three": "^0.155.1",
"@xyflow/react": "12.0.0",
"@xyflow/react": "12.0.4",
"@xyflow/xy-ui": "workspace:*",
"clsx": "^1.2.1",
"fast-xml-parser": "^4.2.6",
Expand Down

0 comments on commit a15748c

Please sign in to comment.