From 0a53b45858fbb20f10c141794f2f107bd6b68e26 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 26 Jun 2023 11:14:51 +0200 Subject: [PATCH] CollapsingHeader/TreeNode: Fixed text padding when using _Framed+_Leaf flags. (#6549) --- docs/CHANGELOG.txt | 4 +++- imgui_widgets.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 076b3e83..77ac2a91 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -67,7 +67,9 @@ Other changes: - IsWindowHovered, IsItemHovered: Assert when passed any unsupported flags. - Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either ScrollX or ScrollY flags from being impossible to resize. (#6503) -- InputText: Fixed not returning true when buffer is cleared by ImGuiInputTextFlags_EscapeClearsAll. (#5688, #2620) +- CollapsingHeader/TreeNode: Fixed text padding when using _Framed+_Leaf flags. (#6549) [@BobbyAnguelov] +- InputText: Fixed not returning true when buffer is cleared while using the + ImGuiInputTextFlags_EscapeClearsAll flag. (#5688, #2620) - Clipper: Rework inner logic to allow functioning with a zero-clear constructor. This is order to facilitate usage for language bindings (e.g cimgui or dear_binding) where user may not be callinga constructor manually. (#5856) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index a6991793..87daaae7 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6262,7 +6262,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l else if (!is_leaf) RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 1.0f); else // Leaf without bullet, left-adjusted text - text_pos.x -= text_offset_x; + text_pos.x -= text_offset_x -padding.x; if (flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton) frame_bb.Max.x -= g.FontSize + style.FramePadding.x;