Repository navigation
✨ Implement "Drop Node on Link" feature - #409
Conversation
MFA-X-AI
left a comment
There was a problem hiding this comment.
Thanks for the PR! This is one of the most requested feature, would be very helpful so users wouldn't have to disconnect and connect nodes when trying to have something between them.
One additional thing I'd like to request is for you to save the link point coordinates, and recreate them if a node is created. Consider a case like this where a user wired the link neatly
adding a node between will recreate the link from scratch
Thanks.
Unified behavior for missing-port nodes dropped from canvas or sidebarPreviously, there was inconsistent behavior when dropping a component that lacks the required ports (
This commit ensures both cases behave the same:
|
|
Thanks for the feedback! I've implemented the requested behavior — the link's bend-points are now preserved when a node is inserted between two connected nodes. This should maintain the original wire layout as expected. |
MFA-X-AI
left a comment
There was a problem hiding this comment.
The implementation for getting the points seems very convoluted. In Storm React Diagram, a line object has Points as its property. You should be able to access them, save the coordinates and recreating them. Here's an example of how I did it.
https://github.com/XpressAI/xircuits/blob/master/src/commands/NodeActionCommands.tsx#L764-L799
Thanks for the suggestion! I refactored the logic to use clone() instead of manually slicing and rebuilding the points. |


Description
This PR introduces a new feature that allows users to drag and drop a component directly onto an existing connection, automatically splitting the link and inserting the component in between — whether the component is dragged from the sidebar or from within the canvas itself.
Video Demo
Drop_on_link.mp4
Key Features
🔹 1. Link Hover Detection
out-0 → in-0) using `LinkSplitManager.detectLinkUnderPointer`.🔹 2. Smart Link Splitting
🔹 3. User Feedback
🔹 4. Canvas Integration
Edge Case Handling
File Changes
Notes
Pull Request Type
Type of Change
Tests
Test 1: Insert node from Canvas
Steps:
Expected Result:
The original link is split.
The dragged node is inserted between the two connected nodes.
The canvas updates with two new links:
Test 2: Insert node from Sidebar
Steps:
Expected Result:
Test 3: Node without required ports
Steps:
Expected Result:
➤ “This component can’t connect — missing ports.”
Test 4: Node with existing connections
Steps:
Expected Result:
➤ “One or more ports are already connected. Existing connection will be overwritten.”
Tested on: