Skip to content
This repository was archived by the owner on Oct 29, 2022. It is now read-only.

Commit e746dc3

Browse files
committed
feat: add animated edge type
1 parent 2f266f6 commit e746dc3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

examples/simple-react/src/SimpleAsyncapi.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function Asyncapi() {
230230
let node;
231231
if (document !== undefined) {
232232
node = (
233-
<ApplicationView asyncapi={{ document }} edgeType={'default'} />
233+
<ApplicationView asyncapi={{ document }} edgeType={'animated'} />
234234
);
235235
} else {
236236
node = <h1>Wait...</h1>;

library/src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,6 @@ export type EdgeType =
120120
| 'step'
121121
| 'straight'
122122
| 'floating'
123-
| 'default';
123+
| 'default'
124+
| 'simplebezier'
125+
| 'animated';

library/src/visualiser/helpers/collect-nodes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ export function collectSystemNodes(
190190
for (const incomingApp of incomingConnections[uniqueChannel]) {
191191
const edge = {
192192
id: `${appId}-to-${incomingApp}`,
193-
type: edgeType,
193+
...(edgeType !== 'animated'
194+
? { type: edgeType }
195+
: { animated: true }),
194196
style: { stroke: 'orange', strokeWidth: 4 },
195197
source: appId,
196198
target: incomingApp,
@@ -358,7 +360,7 @@ export function createIncomingNode(
358360
};
359361
const connectionEdge: Edge = {
360362
id: `incoming-${appId}-${data.id}`,
361-
type: edgeType,
363+
...(edgeType !== 'animated' ? { type: edgeType } : { animated: true }),
362364
style: { stroke: '#7ee3be', strokeWidth: 4 },
363365
target: appId,
364366
source: data.id,
@@ -395,7 +397,7 @@ export function createOutgoingNode(
395397
};
396398
const connectionEdge: Edge = {
397399
id: `outgoing-${appId}-${data.id}`,
398-
type: edgeType,
400+
...(edgeType !== 'animated' ? { type: edgeType } : { animated: true }),
399401
style: { stroke: 'orange', strokeWidth: 4 },
400402
source: appId,
401403
target: data.id,

0 commit comments

Comments
 (0)