From b9ebb8e06f9c6e254a718f5384a0ca438cbc4c12 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Oct 2023 16:13:29 +0200 Subject: [PATCH] Tables: fixed right-clicking right-most section (past right-most column) from highlighting right-most column. --- docs/CHANGELOG.txt | 1 + imgui.h | 2 +- imgui_tables.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 35c57780..d379e26b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -103,6 +103,7 @@ Other changes: - Tables: Fixed bottom-most and right-most outer border offset by one. (#6765, #3752) [@v-ein] - Tables: Fixed top-most outer border being drawn with both TableBorderLight and TableBorderStrong in some situations, causing the earlier to be visible underneath when alpha is not 1.0f. +- Tables: fixed right-clicking right-most section (past right-most column) from highlighting a column. - TabBar: Fixed position of unsaved document marker (ImGuiTabItemFlags_UnsavedDocument) which was accidentally offset in 1.89.9. (#6862) [@alektron] - Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer. diff --git a/imgui.h b/imgui.h index bd7743a0..46d3b3ba 100644 --- a/imgui.h +++ b/imgui.h @@ -507,7 +507,7 @@ namespace ImGui // - Most widgets return true when the value has been changed or when pressed/selected // - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state. IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0, 0)); // button - IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text + IMGUI_API bool SmallButton(const char* label); // button with (FramePadding.y == 0) to easily embed within text IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape IMGUI_API bool Checkbox(const char* label, bool* v); diff --git a/imgui_tables.cpp b/imgui_tables.cpp index edd5dfba..01851bf6 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2919,9 +2919,9 @@ void ImGui::TableHeadersRow() TableUpdateLayout(table); // Open row - const float row_y1 = GetCursorScreenPos().y; const float row_height = TableGetHeaderRowHeight(); TableNextRow(ImGuiTableRowFlags_Headers, row_height); + const float row_y1 = GetCursorScreenPos().y; if (table->HostSkipItems) // Merely an optimization, you may skip in your own code. return; @@ -2943,7 +2943,7 @@ void ImGui::TableHeadersRow() ImVec2 mouse_pos = ImGui::GetMousePos(); if (IsMouseReleased(1) && TableGetHoveredColumn() == columns_count) if (mouse_pos.y >= row_y1 && mouse_pos.y < row_y1 + row_height) - TableOpenContextMenu(-1); // Will open a non-column-specific popup. + TableOpenContextMenu(columns_count); // Will open a non-column-specific popup. } // Emit a column header (text + optional sort order)