-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds ability to select and remove connections, fixes #107 #116
Conversation
@Tokyros is attempting to deploy a commit to the Flyde Team on Vercel. A member of the Team first needs to authorize it. |
flow-editor/src/visual-node-editor/SelectionIndicator/SelectionIndicator.tsx
Show resolved
Hide resolved
!ids.includes(getConnectionId({from, to})) && | ||
ids.indexOf(from.insId) === -1 && | ||
ids.indexOf(to.insId) === -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, but.. boy scout rule
!ids.includes(getConnectionId({from, to})) && | |
ids.indexOf(from.insId) === -1 && | |
ids.indexOf(to.insId) === -1 | |
!ids.includes(from.insId) && | |
!ids.includes(to.insId) |
@@ -162,6 +164,7 @@ export type ClipboardData = { | |||
export type GroupEditorBoardData = { | |||
viewPort: ViewPort; | |||
selected: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we have selected connections "selected" becomes (even more) vague
selected: string[]; | |
selectedInstances: string[]; |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Tokyros awesome work! |
core/src/connect/helpers.ts
Outdated
@@ -131,6 +131,14 @@ export function connectionData(fromRaw: any, toRaw: any, delayed?: any): any { | |||
}; | |||
} | |||
|
|||
export const getConnectionId = (connectionData: ConnectionData) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if core is the place for this util - can't see a core usage for it
9941b02
to
046c933
Compare
Thanks @Tokyros, awesome work 🕺 |
Description
Issue link - #107
This PR implements the ability to select connection via mouse click.
Once selected connections can be delete via backspace key or by clicking the "Delete" button on the Selection Indicator action bar at the bottom.
Users cannot select connections and Node instances at the same time, so selecting either will clear the selection of the other.
Implementation details
<path>
element with the same shape and a larger stroke then the connection one, all mouse events are registered to this invisible path.Once the mouse is in the range of selection the connection will be highlighted and dashed.
selectedConnections
state to differentiate it from the node instances selection.pointer-events: none
which was preventing any pointer actions on the connections svg, had to also ammend the selection box logic because it broke after removing it.