-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Flooring of clip rectangle on negative monitor coordinates cuts off content #6861
Comments
Looks like this is the the same #2884 I've been a little stubbornly looking into implementing the full solution of remapping viewport coordinates, but I think we should be able to at least implement the quick-and-incomplete fix for |
Could you try replacing those 4 outer |
It does indeed seem to solve the problem in the example and our application where it appeared in quite a few places. |
I have pushed c418685 for this. I currently don't have a multi-monitor setup anymore but I believe it'll be a good test case to add to the ImGui Test Suite using mock viewport emulation, I'll work on a test for this later (simulate negative coordinate viewport, verify dimensions of some rectangles). Thanks for pushing this again and making a nice bug report. |
So basically |
This is a good point. You'd be surprised to find out I forgot about the In principle as it could be a frequently called function in user code, I'd be cautious to rename this even though it is in imgui_internal.h, but it's highly unlikely that a change in behavior of |
ImGui:
ImPlot:
imgui-node-editor:
|
Version/Branch of Dear ImGui:
Version: 1.90 WIP (18992)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: (tested with) example_win32_directx11, example_win32_opengl3, custom backend
Operating System: Windows 10
Issue:
On a setup with multiple monitors, content inside an imgui child window gets clipped on the left side of the clipping rectangle if the viewport/platform window is positioned on a monitor with negative X coordinates.
On Windows, when using multiple monitors, one monitor is always set as the 'main monitor'. Other monitors can then be positioned left, right, above or below. All monitors together use one big coordinate system with the origin being in the top left corner of the main monitor (at least on all my systems/setups). On a setup where there is a monitor left to the main monitor, most coordinates used by Windows will become negative on the x axis. This includes e.g. mouse position or window position.
If we move our window to such a monitor with negative x coordinates, imgui items that are very close to the clipping rectangle border can be cut off as seen here:
The effect is most notable with frame borders enabled (and a high contrast) but to a sharp eye it is also visible on widgets with rounded frames. The text is also affected.
A possible monitor setup is the one below as seen in the Windows 10 desktop settings.
![image](https://private-user-images.githubusercontent.com/9118389/270415984-93898297-edd0-49be-a59c-075d1631dedd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MTMwNzUsIm5iZiI6MTcyMTUxMjc3NSwicGF0aCI6Ii85MTE4Mzg5LzI3MDQxNTk4NC05Mzg5ODI5Ny1lZGQwLTQ5YmUtYTU5Yy0wNzVkMTYzMWRlZGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjBUMjE1OTM1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTY5ZWQwNDU1MWQxMDJlNzJjMzcwMTlmNWNmMzIxMTE1MzI1ODkwYjk4Yjg0NTlkYzdjMzMxZWIxNGViNThlYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.HesiDSQk133r55vFz_usXWfuZZ-QM-7LzkyV7Z0yIp8)
The platform window of the imgui application would have to be on screen one with this setup.
My best guess is that internally the clipping rectangle coordinates get floored which in the worst case usually shifts the left clipping rectangle border <1px to the left. However for negative floats this will shift the left border <1px to the right.
The culprit seems to be the code below (imgui.cpp ImGui::Begin(), Line: 7157) where the clipping rectangle gets floored.
There is probably a smarter way to solve this than adding a check for negative coordinates but I'm not sure.
The text was updated successfully, but these errors were encountered: