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

Commit

Permalink
feat: add animated edge type
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Sep 28, 2022
1 parent 2f266f6 commit e746dc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/simple-react/src/SimpleAsyncapi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function Asyncapi() {
let node;
if (document !== undefined) {
node = (
<ApplicationView asyncapi={{ document }} edgeType={'default'} />
<ApplicationView asyncapi={{ document }} edgeType={'animated'} />
);
} else {
node = <h1>Wait...</h1>;
Expand Down
4 changes: 3 additions & 1 deletion library/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,6 @@ export type EdgeType =
| 'step'
| 'straight'
| 'floating'
| 'default';
| 'default'
| 'simplebezier'
| 'animated';
8 changes: 5 additions & 3 deletions library/src/visualiser/helpers/collect-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ export function collectSystemNodes(
for (const incomingApp of incomingConnections[uniqueChannel]) {
const edge = {
id: `${appId}-to-${incomingApp}`,
type: edgeType,
...(edgeType !== 'animated'
? { type: edgeType }
: { animated: true }),
style: { stroke: 'orange', strokeWidth: 4 },
source: appId,
target: incomingApp,
Expand Down Expand Up @@ -358,7 +360,7 @@ export function createIncomingNode(
};
const connectionEdge: Edge = {
id: `incoming-${appId}-${data.id}`,
type: edgeType,
...(edgeType !== 'animated' ? { type: edgeType } : { animated: true }),
style: { stroke: '#7ee3be', strokeWidth: 4 },
target: appId,
source: data.id,
Expand Down Expand Up @@ -395,7 +397,7 @@ export function createOutgoingNode(
};
const connectionEdge: Edge = {
id: `outgoing-${appId}-${data.id}`,
type: edgeType,
...(edgeType !== 'animated' ? { type: edgeType } : { animated: true }),
style: { stroke: 'orange', strokeWidth: 4 },
source: appId,
target: data.id,
Expand Down

0 comments on commit e746dc3

Please sign in to comment.