mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-24 12:47:01 +00:00
Fixed minor title bar text clipping issue when FramePadding is small/zero and there are no close button in the window. (#3731)
This commit is contained in:
parent
a8d2d8ee97
commit
6b32d0ebc7
@ -37,6 +37,8 @@ HOW TO UPDATE?
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Window: Fixed minor title bar text clipping issue when FramePadding is small/zero and there are no
|
||||
close button in the window. (#3731)
|
||||
- ImDrawList: Fixed AddCircle()/AddCircleFilled() with (rad > 0.0f && rad < 1.0f && num_segments == 0). (#3738)
|
||||
Would lead to a buffer read overflow.
|
||||
- Backends: Win32: Dynamically loading XInput DLL instead of linking with it, facilite compiling with
|
||||
|
@ -5511,7 +5511,7 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||
const ImVec2 text_size = CalcTextSize(name, NULL, true) + ImVec2(marker_size_x, 0.0f);
|
||||
|
||||
// As a nice touch we try to ensure that centered title text doesn't get affected by visibility of Close/Collapse button,
|
||||
// while uncentered title text will still reach edges correct.
|
||||
// while uncentered title text will still reach edges correctly.
|
||||
if (pad_l > style.FramePadding.x)
|
||||
pad_l += g.Style.ItemInnerSpacing.x;
|
||||
if (pad_r > style.FramePadding.x)
|
||||
@ -5525,8 +5525,9 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||
}
|
||||
|
||||
ImRect layout_r(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y, title_bar_rect.Max.x - pad_r, title_bar_rect.Max.y);
|
||||
ImRect clip_r(layout_r.Min.x, layout_r.Min.y, layout_r.Max.x + g.Style.ItemInnerSpacing.x, layout_r.Max.y);
|
||||
//if (g.IO.KeyCtrl) window->DrawList->AddRect(layout_r.Min, layout_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]
|
||||
ImRect clip_r(layout_r.Min.x, layout_r.Min.y, ImMin(layout_r.Max.x + g.Style.ItemInnerSpacing.x, title_bar_rect.Max.x), layout_r.Max.y);
|
||||
//if (g.IO.KeyShift) window->DrawList->AddRect(layout_r.Min, layout_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]
|
||||
//if (g.IO.KeyCtrl) window->DrawList->AddRect(clip_r.Min, clip_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]
|
||||
RenderTextClipped(layout_r.Min, layout_r.Max, name, NULL, &text_size, style.WindowTitleAlign, &clip_r);
|
||||
if (flags & ImGuiWindowFlags_UnsavedDocument)
|
||||
{
|
||||
@ -6118,7 +6119,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
|
||||
// Title bar
|
||||
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
||||
RenderWindowTitleBarContents(window, title_bar_rect, name, p_open);
|
||||
RenderWindowTitleBarContents(window, ImRect(title_bar_rect.Min.x + window->WindowBorderSize, title_bar_rect.Min.y, title_bar_rect.Max.x - window->WindowBorderSize, title_bar_rect.Max.y), name, p_open);
|
||||
|
||||
// Clear hit test shape every frame
|
||||
window->HitTestHoleSize.x = window->HitTestHoleSize.y = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user