ImNodes icon indicating copy to clipboard operation
ImNodes copied to clipboard

Add picture inside of the node

Open aabilityuk opened this issue 4 years ago • 3 comments

Hi, first of all I want to thank the developers for efforts and spent time for lib dev!

Is it possible to add picture to the node background and custom setup the pins distance and positions inside of the node?

If not, is there any plans in future to add this feature?

Thank you!

aabilityuk avatar Jul 26 '21 05:07 aabilityuk

You could set node background to a transparent color and render image background using ImGui::Image(), explicitly positioning it before drawing. Node positions are hardcoded and you would have to modify EndSlot() in ImNodes.cpp to change that. No plans to implement position customization for now.

rokups avatar Jul 26 '21 08:07 rokups

You could set node background to a transparent color and render image background using ImGui::Image(), explicitly positioning it before drawing. Node positions are hardcoded and you would have to modify EndSlot() in ImNodes.cpp to change that. No plans to implement position customization for now.

Thank you very much for a quick reply! I am really new with your library and imgui., may I ask you to show me a brief code example of how to set the node background to transparent color and how to use ImGui::Image () to explicitly position and add image to the node background? Also is it possible not to show the node borders and title because I need only the image and pins connected to it?

Thank you!!! I will take a look on the EndSlot().

aabilityuk avatar Jul 26 '21 09:07 aabilityuk

Colors are set in CanvasState::Colors array, use StyleColor for array indexing. Item position is set with ImGui::SetCursorPosition().

rokups avatar Jul 26 '21 10:07 rokups