Skip to content

Commit 7df22e6

Browse files
committed
delete thumbs/ports on compositions
1 parent c5cb38f commit 7df22e6

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

libs/app-canvas/src/app/app.element.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,33 @@ export class AppElement<T extends BaseNodeInfo> {
14971497
}
14981498
});
14991499

1500+
existingThumbs.forEach((element) => {
1501+
const nodeHelper = element as unknown as IRectNodeComponent<T>;
1502+
const baseNodeInfo = nodeHelper.nodeInfo as BaseNodeInfo;
1503+
1504+
let isExistingThumb = false;
1505+
canvasApp?.elements.forEach((canvasElement) => {
1506+
if (canvasElement.id === nodeHelper.id) {
1507+
isExistingThumb = true;
1508+
}
1509+
});
1510+
if (!isExistingThumb && this.canvasApp) {
1511+
let thumbType: ThumbType = ThumbType.EndConnectorLeft;
1512+
let thumbConnectionType: ThumbConnectionType =
1513+
ThumbConnectionType.end;
1514+
if (baseNodeInfo?.type === 'thumb-output') {
1515+
thumbType = ThumbType.StartConnectorRight;
1516+
thumbConnectionType = ThumbConnectionType.start;
1517+
}
1518+
// thumb removed
1519+
this.deleteThumbFromComposition(this.canvasApp, composition.id, {
1520+
thumbType: thumbType,
1521+
connectionType: thumbConnectionType,
1522+
name: nodeHelper.id,
1523+
} as IThumb);
1524+
}
1525+
});
1526+
15001527
// Only store the nodes and not the thumbs and connections to the thumbs
15011528
// nodesIdsToIgnore contains the node and connection id's of the thumbs
15021529
// and connections to the thumbs. In below code this list gets updated

libs/visual-programming-system/src/canvas-app/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,9 +1650,7 @@ export class FlowCanvas<T extends BaseNodeInfo>
16501650

16511651
if (rectInstance.nodeComponent?.thumbConnectors) {
16521652
const thumbIndex = rectInstance.nodeComponent.thumbConnectors.findIndex(
1653-
(t) =>
1654-
t.thumbIdentifierWithinNode === thumb.thumbIdentifierWithinNode &&
1655-
thumb.thumbIdentifierWithinNode
1653+
(t) => t.thumbName === thumb.name && thumb.name
16561654
);
16571655
if (thumbIndex >= 0) {
16581656
const thumbNode =

0 commit comments

Comments
 (0)