Skip to content

Commit 198a723

Browse files
Claudeclaude
andcommitted
Fix connection drag placeholder positioning and implement custom SVG connections
Replace jsPlumb with custom SVG-based connection system. Plumber handles connection drawing with face-aware anchor distribution (top/left/right). Fixed placeholder node positioning during drag-up by passing sourceX/sourceY in drag events. Updated tests for new routing logic and connection management API. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 334c79e commit 198a723

File tree

7 files changed

+1176
-1046
lines changed

7 files changed

+1176
-1046
lines changed

src/flow/CanvasMenu.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ export class CanvasMenu extends RapidElement {
9898
): void {
9999
super.firstUpdated(_changedProperties);
100100

101-
// Close menu when clicking outside
101+
// Close menu when clicking outside — use mousedown instead of click
102+
// to avoid being triggered by the click synthesized from a drag-and-drop
103+
// (mousedown on exit + mouseup on canvas = click on common ancestor)
102104
const handleClickOutside = (e: MouseEvent) => {
103105
if (this.open && !this.contains(e.target as Node)) {
104106
this.close();
105107
}
106108
};
107109

108-
document.addEventListener('click', handleClickOutside);
110+
document.addEventListener('mousedown', handleClickOutside);
109111

110112
// Store cleanup function
111113
(this as any)._clickOutsideHandler = handleClickOutside;
@@ -114,7 +116,7 @@ export class CanvasMenu extends RapidElement {
114116
disconnectedCallback(): void {
115117
super.disconnectedCallback();
116118
if ((this as any)._clickOutsideHandler) {
117-
document.removeEventListener('click', (this as any)._clickOutsideHandler);
119+
document.removeEventListener('mousedown', (this as any)._clickOutsideHandler);
118120
}
119121
}
120122

src/flow/CanvasNode.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,7 @@ export class CanvasNode extends RapidElement {
360360
position: relative;
361361
box-shadow: 0 2px 2px rgba(0, 0, 0, .1);
362362
cursor: pointer;
363-
pointer-events: none;
364-
}
365-
366-
.exit.jtk-connected {
367-
background: var(--color-connectors, #e6e6e6);
363+
pointer-events: all;
368364
}
369365
370366
.exit.connected {
@@ -376,11 +372,14 @@ export class CanvasNode extends RapidElement {
376372
background-color: var(--color-connectors, #e6e6e6);
377373
}
378374
379-
.exit.connected.read-only, .exit.connected.read-only:hover {
380-
background-color: #fff;
375+
.exit.read-only, .exit.read-only:hover {
381376
pointer-events: none !important;
382377
cursor: default;
383378
}
379+
380+
.exit.connected.read-only, .exit.connected.read-only:hover {
381+
background-color: #fff;
382+
}
384383
385384
.exit.removing, .exit.removing:hover {
386385
background-color: var(--color-error);

0 commit comments

Comments
 (0)