-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically remove window padding after Begin() call #3756
Comments
You can't change the That single line is due to Use Demo>Tools>Metrics/Debugger to visualize the clipping rectangle of each ImDrawCmd. |
Linking to #3312 |
@Vine1 Not sure if you ever figured this out, I came across it while trying to figure it out myself, as I was actually trying to do the same thing you were with a custom header without wanting to push the window padding to 0,0. I was trying to work with what ocornut mentioned, that being: Turns out, that was the problem. When set to true, it limits rendering to the area inside the padding since it's intersecting with the current InnerClipRect. If false, you can draw the pushed ClipRect onto the WindowPadding area (or anywhere on the screen, for that matter). —which makes sense in hindsight, but it’s easy to overlook when you’re deep in testing. Hopefully, this helps anyone else who runs into the same issue down the line! |
Hello! I'm developing my custom menu bar. It should look like a rectangle at top of the window, without paddings at the top, left, and right sides. My style has window padding for child windows, but ImGui uses this option for the simple windows too. So, my menu bar draws indented My application architecture draws UI element by element, after Begin call, so I can't give access to an element to call PushStyleVar(ImGuiStyleVar_WindowPadding) before Begin(). Also, the menu bar may be dynamically removed and added back, so, I can't just statically push the window padding variable before Begin() call. Also, change the style.WindowPadding I can't too because I need padding for child windows, and maybe in the future, I will need window padding for simple windows without a custom menu bar.
So, Is it possible to remove the current window padding after Begin() (or maybe just draw one frame bypassing padding)?
What I have tried already:
Nothing worked. If it's not possible, I'll find a way to call PushStyleVar before Begin(), but it'll hurt the architecture.
I hope for your help! Thanks in advance!
EDIT:
Example:
Screenshot with padding 20:


And with padding 0:
Why even drawing through ImDrawList depends on padding? How to bypass it?
The text was updated successfully, but these errors were encountered: