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

Unable to draw on whole surface of the window #6365

Closed
vuvvuk opened this issue Apr 24, 2023 · 2 comments
Closed

Unable to draw on whole surface of the window #6365

vuvvuk opened this issue Apr 24, 2023 · 2 comments

Comments

@vuvvuk
Copy link

vuvvuk commented Apr 24, 2023

Version/Branch of Dear ImGui:

Version: v1.89.3
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: OpenGL 3.0
Compiler:
Operating System: Windows 11

My Issue/Question:

I am trying to draw a circle which fits the window size (e.g. radius of circle is 200 and window size is 200x200) and I encountered the problem from screenshot below where first few and last few columns are not "accessible" to draw in. I could "fix" this issue by setting the window start position to be negative, and to have a slightly larger window - but this approach seems too hacky. Am I missing some flag for the window because it seems WindowBorderSize does not do the trick?

(Sorry if there is already similar issue - I only found #1758, or if this is something obvious that I am missing).

Screenshots/Video

image

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

{
    ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
    ImGui::SetNextWindowSize(ImVec2(200.0f,200.0f));
    ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
    ImGui::Begin("Circle", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground);
    
    auto* draw_list = ImGui::GetWindowDrawList();
    draw_list->AddCircleFilled(ImVec2(100.0f,100.0f), 100.0f, ImColor(255,0,0));
  
    ImGui::End();
    ImGui::PopStyleVar();
}
@ocornut
Copy link
Owner

ocornut commented Apr 24, 2023

Hello,

You should also be pushing a zero value for ImGuiStyleVar_WindowPadding (or alternatively you can push a clip rect manually).

You'll find a more detailed explanation in #3312 : we currently push a default clip-rect that remove half-windowpadding on left and right sides. I think we will eventually remove this behavior as discussed in #3312, so down the line that won't be needed.
Use Metrics->DrawList to visualize Clipping Rectangle for a given draw command, and you'll be able visualize the current default ClipRect extents.

@vuvvuk
Copy link
Author

vuvvuk commented Apr 24, 2023

Hi,

Thank you for help! This solved the issue, I totally missed window padding in the flags of ImGuiStyleVar_.

Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants