mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-04 10:07:58 +00:00
Two childs not overlapping eachother #4493
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#4493
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thank you!
My Issue/Question:
I've got two childs, one child(1) has a button/text init the second child(2) has a move button that moves the child(2) on top of the other child(1), my problem is that even though the child() is on top of the child(1) the button/text is still visible.
Screenshots/Video
https://user-images.githubusercontent.com/89664487/131185803-881f6e16-571b-43b3-bb4e-e3636434a282.mp4
The ChildBg rectangle is drawn on the parent to save a draw call. If you look for that code drawing the background you’ll find there’s a rule for it you may be able to workaround.
Check the code that calls RenderWindowDecorations().
Detecting overlapping childs would be a O(log N) operation I don’t fancy but since our heuristic lastest so long (since 1.71) without another report, I think we could add to checking of previous child as part of the heuristic and it would fix a good portionncases (including yours which technically is the first reported case).
Thank you for the fast reply! Will do.
Pushed a fix for this case.
Here's some minimal working test:
This optimization causes z-order issues when a child window overlaps another submitted earlier, before the previous.
Minimal code snippet to duplicate
An example of the problem occurring in a real-world scenario (script by @GoranKovac): user-positioned child windows (
InputTextMultiline) are dynamically submitted and any of them may underlap later child windows (the toolbars):This optimization is quite meaningful, so considering we haven't been getting too many requests for that and considering your specific use case, I would suggest to aim for a workaround.
ImGuiWindowFlags_AlwaysUseWindowPaddingto child.If you can think of a way to amend the existing heuristic I'm also open to that.
(Btw there was a minor typo in the code
parent_is_emptywasparent_is_not_empty, I reworked the condition accordingly so the name is not misleading anymore. That'll be in an upcoming commit but it has no effect on compiled code)