Ax9D / pw-viz

Pipewire graph editor written in Rust. WIP⚠️
GNU General Public License v3.0
230 stars 14 forks source link

Remove links the same way you create them #12

Open Atakku opened 2 years ago

Atakku commented 2 years ago

It seems to be much more intuitive to just remove links by dragging them over the same path again, as you would create them.

Atakku commented 2 years ago

I have alt used for dragging around windows in my WM, and helvum removes links the way I described above

jansol commented 2 years ago

With how it currently works, that would make it impossible to link the same port to multiple nodes.

However making this work more like Blender would solve your problem (and help make the Linux ecosystem marginally more consistent).

At a quick glance Blender seems to be working like this, when dragging from a port that has one or more links:

Dragging from an empty port always creates a new link.

Atakku commented 2 years ago

Sorry, blender wasn't the best analogy. How about helvum, it has the behavior I described

jansol commented 2 years ago

Ah okay, seems I'd misunderstood your first post. So performing the same drag gesture between two ports that are already linked would delete the link. That does indeed work even for an arbitrary number of links since any given pair of ports can only have one link between them.

The main shortcoming of the way it is done in Helvum is that there is practically no visual hint about what you are currently doing until you are hovering the mouse cursor on the destination node (assuming the drag gesture went in the right direction, if not, nothing happens), and deleting links seems to show the same cursor as adding them. With proper (live) UI feedback it could be made decently usable I guess. And adding and deleting nodes should not care about the direction of the drag gesture, i.e. draggin from an output to an input and from an input to an output should both yield the same result.

Now that I think of it, the Blender way does not work as is anyway, since in Blender it does not make sense to have multiple links connected to the same input port, whereas in Pipewire that is very common. I do however find that Blender feels closer to the analogy of plugging in and unplugging physical cables. Not sure what the best way to keep that would be. Having a key that toggles between creating and deleting nodes is nice (especially if the key was configurable) but it does not solve the ambiguity when multiple links connect to the same port. Being able to select a link by clicking and presssing delete would be easy and unambiguous. Your solution would also work but requires a fair amount of UI feedback work.

Ax9D commented 2 years ago

I agree with @jansol on this, dragging back a link completely along the same path would be very tedious for complex graphs, dragging back a link from an input port slightly and ending the drag to delete it makes more sense imo I have a patch for egui_nodes which enables this behaviour: drag_back and this works without holding Alt ofcourse

jansol commented 2 years ago

How does it choose which link to disconnect if there are multiple links to the same input?

mriise commented 2 years ago

@jansol I came across this issue yesterday, when multiple links are put into the same input it will select whichever seems to be on "top" i think. So trying to remove a single link you may have to remove multiple lines before you are able to grab the line you wanted, which is annoying. Being able to drag from somewhere along the middle of the line to disconnect would allow for moving nodes around to clear the area around a line so there is easier access to grab just the one you intend.

actionless commented 2 years ago

How does it choose which link to disconnect if there are multiple links to the same input?

mb by right click on the link point to show dropdown menu which will allow to choose which of the nodes is 'active'