Skip to content
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

FramePadding Is Not Re-Aligned For Clipping When Altered #3731

Closed
atom0s opened this issue Jan 18, 2021 · 4 comments
Closed

FramePadding Is Not Re-Aligned For Clipping When Altered #3731

atom0s opened this issue Jan 18, 2021 · 4 comments

Comments

@atom0s
Copy link

atom0s commented Jan 18, 2021

Version/Branch of Dear ImGui: 0ea4408 (Latest as of this post.)

Version: 1.80WIP
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx9.cpp (and my own for Direct3D8)
Compiler: Visual Studio 2019 16.8.4
Operating System: Windows 10

My Issue/Question:

When altering the global FramePadding value, the clip handling inside of ImGui does not account for the changes.
This causes things like text to run past their expected clipping sections.

This is reproducible in the main branch code, as-is just by altering the FramePadding size.

  1. Clone the latest master.
  2. Compile the examples.
  3. Run the Direct3D9 example.
  4. Open the Styles editor. (Tools -> Style Editor)
  5. Change FramePadding to 3x2.

Next, in the Dear ImGui Demo window, go to Window Options and check No Close.

Now you can slowly resize the window until the title text clips past the window frame. This is easier to see with a magnifier. (Windows has one built-in if needed.)

Screenshots/Video

https://i.imgur.com/mRz1xuJ.png

Standalone, minimal, complete and verifiable example: (see #2261)

See steps above to use the current examples to test this.

@atom0s
Copy link
Author

atom0s commented Jan 18, 2021

Since this is somewhat related, there is also a small issue with the clip rect not accounting for frame borders.
Rendered text will bleed into the frame border as well by 1 pixel, sitting in the frame borders space.

Using the same setup as I outlined above with the d3d9 example, setting Frame Border Size to 1 yields:
https://i.imgur.com/0mJnc1D.png

Without it enabled, the title text also still bleeds into the edge of the window too:
https://i.imgur.com/YpxRQCi.png

@ocornut
Copy link
Owner

ocornut commented Jan 18, 2021

Hello,

I can repro the first issue but not the second (which doesn't have a repro listed), even with WindowPadding.x = 0:
image

(PS: you can disable "Smoothing" in Windows's horrible magnifying tool)

@atom0s
Copy link
Author

atom0s commented Jan 18, 2021

For the second one, it is just that the word is hitting the edge of the window vs. being 1-pixel inset to the edge of the window.

For reproducing this one:

  1. Clone current master.
  2. Build examples.
  3. Run Direct3D 9 example.
  4. In the demo window, Window Options -> Check No Close
  5. Resize the window til the word Demo is against the right-side edge of the window.

https://i.imgur.com/9rNZrdS.png

Here the 'O' in Demo is hitting the very edge of the window where the 1-pixel frame is. If you turn on/off the window border, the font is not adjusted based on it being there. It just sits ontop of it.

ocornut added a commit that referenced this issue Jan 26, 2021
…zero and there are no close button in the window. (#3731)
@ocornut
Copy link
Owner

ocornut commented Jan 26, 2021

Both issues should be fixed by 6b32d0e
Thank you!

@ocornut ocornut closed this as completed Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants