Comments (4)
This is one way of doing it. You need to create a draw list after imnodes::BeginNodeEditor
and submit the draw calls (AddRectFilled
, etc.) before you start a single node! In this way, all the nodes get rendered after the custom rectangle, and look like they are on top of it.
imnodes::BeginNodeEditor();
ImDrawList* draw_list = ImGui::GetWindowDrawList();
draw_list->AddRectFilled(
ImVec2(100, 100),
ImVec2(400, 300),
IM_COL32(200, 200, 200, 100));
imnodes::BeginNode(1);
imnodes::BeginNodeTitleBar();
// the rest of the node, etc..
There is one drawback: you probably need to know the size of the rectangle based on the nodes themselves. But you don't know where the nodes are going to be until you render them! One solution is to render the rectangle based on the nodes of the previous frame, but this means that if the nodes are moved around the rectangle might be a bit laggy.
from imnodes.
Thanks, this way is a cheap way to meet the goal. About the size of the rect, it's fine as the application has the position of all nodes. The only issue is the rect's position is not the saome coordinate system with imnodes, need to do an extra job to fix this. If imnodes can provide two interfaces as below would be great:
void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners, float thickness);
void AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners);
Actually I want to do this job and do a PR, but unfortunately, I can't do this job as I have not understood imnodes's coordinate system very clean.
from imnodes.
I saw you opened the pr for fetching the panning value, I guess that solves the problem for now? 🙂 The pr is also, IMO, a better solution than adding AddRect
functions 👍
from imnodes.
Yes, now meet the goal, thanks for your help!
from imnodes.
Related Issues (20)
- Output pin text not rendering correctly. HOT 2
- Using a CollapsingHeader/treenode inside a node, it's ui goes out of bounds of the node; HOT 1
- Callback on node translation HOT 2
- Mis-Entering BoxSelection Interaction. HOT 2
- phantom TitleBar rect glitch when conditionnal call to BeginNodeTitleBar
- [Feature Request] Vertical Pins HOT 3
- Node id's are overlapped when we have many attributes and nodes. HOT 1
- emscripten + Saving editor state
- Canvas on nodes HOT 3
- Overlapping nodes aren't compatible with ImGui::BeginDragDropTarget() HOT 1
- Style
- Popup over Grid/Node? HOT 1
- Doesn't work with BeginChild HOT 2
- Compute graph example - multiple outputs? HOT 1
- NodeAnimation HOT 2
- node double click event HOT 1
- Isn't this maintained anymore? HOT 2
- IM_OFFSETOF deprecation
- Question: Creating a NESTED canvas?
- Make node, pins and links work with BeginPopupContextItem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imnodes.