rete icon indicating copy to clipboard operation
rete copied to clipboard

Drag multiple Nodes on seperate click is moving the relative node position

Open CorneliaRapp2 opened this issue 5 years ago • 2 comments

In the plug-in, multiple nodes can only be moved if you hold Ctrl and select several nodes and then immediately drag those nodes without letting the mouseButton go, right? I wanted it to be more like the Unreal editor in terms that I want the selection to stay when you click on a node that is part of the selection instead of just selecting that one node then. Furthermore, I wanted to be able to drag the selected nodes then. I did this (since I cannot alter the plugin really) by buffering the selected nodes and reselecting them when a node is clicked that is in this buffer.

So here is the issue: Whenever I drag the construct now (two selected nodes), the node that I do not directly drag changes it's relative position on the first dragstep (so not continuously, just in the beginning). obviously, I dont want this. I also do not understand why this happens and how to fix it though, because I did not change anything about how the" drag/translate nodes"-thing works, and I don't get it. Thank you in advance for your help!

CorneliaRapp2 avatar May 29 '20 07:05 CorneliaRapp2

Hi, I'm currently facing the same issue regarding the translation of the nodes. I'm trying to drag multiple nodes without the need of holding CTRL and the way I was trying to achieve it was by preventing the selection event if the node I'm pressing onto was already selected. (To make this usable I also added a "click outside a node to deselect".)

This is the piece of code that is causing me the node translation issue is this:

ReteComponent.editor.on("nodeselect", (node) => { if (ReteComponent.editor.selected.contains(node)) { return false; } });

It works correctly but it looks like it's not updating the position of the rest of the nodes.

I haven't figured a way around it yet but I'll post here if I come up with something that's working

damiano-sca avatar Jul 13 '21 15:07 damiano-sca

Got it, when you prevent the (de)selection event, add

editor.trigger('nodeselected', node);

to force the update of the initial nodes position before dragging.

damiano-sca avatar Jul 13 '21 15:07 damiano-sca

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]