You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm storing node data, including the positions in my own data structure and am a little stuck on how to update my representation of the positions.
When I draw the editor, I'm calling ImNodes::SetNodeScreenSpacePosition from a "realized" graph that contains its positions. Something in the background must be overwriting this behavior as I can drag a node around, but once I release a node - it of course snaps back to the position stored in my data structure.
My question is, how can I intercept the result of node translation in order to update my representation? I tried something the likes of
intnum_selected_nodes=ImNodes::NumSelectedNodes();
if (num_selected_nodes>0&&ImGui::IsMouseReleased(0)) {
int*mod_ids= (int*)malloc(num_selected_nodes*sizeof(int));
ImNodes::GetSelectedNodes(mod_ids);
for (inti=0; i<num_selected_nodes; i++) {
intmod_id=mod_ids[i];
ImVec2pos=ImNodes::GetNodeScreenSpacePos(mod_id);
rs::set_module_position(mod_id, pos[0], pos[1]);
}
free(mod_ids);
}
But GetNodeScreenSpacePos doesn't seem to be set by the time my if block runs, as it still contains the original position.
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
@kiranshila I just encountered the same problem as well, you can test my implementation of this feature
It works in my project, I'm able now to save positions of nodes between save/load sessions
If you have any questions on it, feel free to ask
Hey! First off, thanks for the great library!
I'm storing node data, including the positions in my own data structure and am a little stuck on how to update my representation of the positions.
When I draw the editor, I'm calling
ImNodes::SetNodeScreenSpacePosition
from a "realized" graph that contains its positions. Something in the background must be overwriting this behavior as I can drag a node around, but once I release a node - it of course snaps back to the position stored in my data structure.My question is, how can I intercept the result of node translation in order to update my representation? I tried something the likes of
But
GetNodeScreenSpacePos
doesn't seem to be set by the time my if block runs, as it still contains the original position.Any help would be appreciated.
The text was updated successfully, but these errors were encountered: