mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 14:50:41 -07:00
overlay: fix highlights, alignment in presets table (#769)
* Fix table row highlight hover detection in Options tab when row has two lines of text * Fix text alignment in controller presets table
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "external/imgui/imgui.h"
|
||||
#include "external/imgui/imgui_internal.h"
|
||||
#include "overlay/overlay.h"
|
||||
|
||||
|
||||
@@ -209,17 +210,17 @@ namespace ImGui {
|
||||
return open;
|
||||
}
|
||||
|
||||
void InvisibleTableRowSelectable() {
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, 0);
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, 0);
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, 0);
|
||||
ImGui::PushTabStop(false); // prevent tab navigation
|
||||
ImGui::Selectable("##row", false,
|
||||
ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
|
||||
ImGui::PopTabStop();
|
||||
ImGui::PopStyleColor(3);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
void HighlightTableRowOnHover() {
|
||||
// hit-test the row rect directly so the row layout and height are untouched
|
||||
ImGuiTable *table = ImGui::GetCurrentTable();
|
||||
if (table == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (ImGui::IsWindowHovered() &&
|
||||
ImGui::IsMouseHoveringRect(
|
||||
ImVec2(table->WorkRect.Min.x, table->RowPosY1),
|
||||
ImVec2(table->WorkRect.Max.x, table->RowPosY2),
|
||||
false)) {
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, IM_COL32(200, 200, 200, 24));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user