From 0ef3be1851ea8275155066948ab0058b1ad49479 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 17 May 2024 20:38:22 +0200 Subject: [PATCH] fix: Look of some buttons and text fields with frame borders turned on --- lib/libimhex/source/ui/imgui_imhex_extensions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index b6491b323..bdec81453 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -718,7 +718,7 @@ namespace ImGuiExt { const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderNavHighlight(bb, id); - RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); + RenderFrame(bb.Min, bb.Max, col, false, style.FrameRounding); RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, nullptr, &label_size, style.ButtonTextAlign, &bb); // Automatically close popups @@ -823,7 +823,7 @@ namespace ImGuiExt { const ImVec2 label_size = CalcTextSize(label, nullptr, true); const ImVec2 frame_size = CalcItemSize(ImVec2(0, 0), CalcTextSize(prefix).x, label_size.y + style.FramePadding.y * 2.0F); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(CalcItemWidth(), frame_size.y)); SetCursorPosX(GetCursorPosX() + frame_size.x); @@ -831,8 +831,10 @@ namespace ImGuiExt { DataTypeFormatString(buf, IM_ARRAYSIZE(buf), type, value, format); bool value_changed = false; + PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0); if (InputTextEx(label, nullptr, buf, IM_ARRAYSIZE(buf), ImVec2(CalcItemWidth() - frame_size.x, label_size.y + style.FramePadding.y * 2.0F), flags)) value_changed = DataTypeApplyFromText(buf, type, value, format); + PopStyleVar(); if (value_changed) MarkItemEdited(GImGui->LastItemData.ID);