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
Version/Branch of Dear ImGui:
Version: 1.90 WIP (18992)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfwcpp + imgui_impl_opengl3.cpp
Compiler: XXX (if the question is related to building or platform specific features)
Operating System: Windows
My Issue/Question:
I'm trying to create a scrollable region using a Child window (BeginChild / EndChild), and in this scrollable region a list of TreeNodes. Basically a scrolling area for a Tree list. Then, I implemented a re-ordering function using the DragDrop feature. However, with the BeginChild / EndChild surrounding my TreeNodes, the yellow rectangle for the DragDropTarget seems wonky (see first gallery).
But if I do not surround my TreeNodes code with BeginChild / EndChild, the yellow rectangle from the DragDropTarget seems working fine (see second gallery).
Screenshots/Video First Gallery: Wonky yellow rectangle for DragDropTarget
Second Gallery: No child window, DragDropTarget's yellow rectangle draws perfectly
Standalone, minimal, complete and verifiable example:
Child window + TreeNodes
Looks like the rectangles are clipped by the draw list of your child window due to no or too little inner padding. You could push an expanded clip rect to the window draw list, but I wouldn't recommend it for the entire child as that would also expand the clipping for the items themselves, so you need to adjust it for the rectangle only.
What you can try:
Between ImGui::BeginDragDropSource() and ImGui::EndDragDropTarget() should be the best place to minimize additional draw calls because of clipping changes since you should get there at most once.
if (ImGui::BeginDragDropTarget())
{
// code untested, but should do the trick
ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->PushClipRectFullScreen();
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_LAYER_REORDER"))
{
// ...
}
drawList->PopClipRect();
ImGui::EndDragDropTarget();
}
This might still look strange if you have a scrollable child and highlight a partially scrolled out item. But instead of pushing a fullscreen clip rect, you could retrieve the current one and expand it just enough that highlights for fully visible items are just barely not clipped.
Alternatively (if you don't mind the additional space), you could use ImGuiWindowFlags_AlwaysUseWindowPadding for your child window, maybe adjust the window padding itself accordingly.
Version/Branch of Dear ImGui:
Version: 1.90 WIP (18992)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfwcpp + imgui_impl_opengl3.cpp
Compiler: XXX (if the question is related to building or platform specific features)
Operating System: Windows
My Issue/Question:
I'm trying to create a scrollable region using a Child window (BeginChild / EndChild), and in this scrollable region a list of TreeNodes. Basically a scrolling area for a Tree list. Then, I implemented a re-ordering function using the DragDrop feature. However, with the BeginChild / EndChild surrounding my TreeNodes, the yellow rectangle for the DragDropTarget seems wonky (see first gallery).
But if I do not surround my TreeNodes code with BeginChild / EndChild, the yellow rectangle from the DragDropTarget seems working fine (see second gallery).
Screenshots/Video
First Gallery: Wonky yellow rectangle for DragDropTarget
Second Gallery: No child window, DragDropTarget's yellow rectangle draws perfectly
Standalone, minimal, complete and verifiable example:
Child window + TreeNodes
Open to see code
No child window + TreeNodes (the difference is just removing the BeginChild & EndChild)
Open to see code
The text was updated successfully, but these errors were encountered: