From 0e5820450160bb62546b0fcd93472b7ca0148913 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 29 Apr 2024 20:06:50 +0200 Subject: [PATCH] impr: Remove underline from hyperlinks if they're not hovered --- lib/libimhex/source/ui/imgui_imhex_extensions.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index 39c6e384f..6755dc632 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -180,7 +180,10 @@ namespace ImGuiExt { PushStyleColor(ImGuiCol_Text, ImU32(col)); Text("%s %s", icon, label); - GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col)); + + if (hovered) + GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col)); + PopStyleColor(); IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); @@ -209,7 +212,10 @@ namespace ImGuiExt { const ImU32 col = hovered ? GetColorU32(ImGuiCol_ButtonHovered) : GetColorU32(ImGuiCol_ButtonActive); PushStyleColor(ImGuiCol_Text, ImU32(col)); TextEx(label, nullptr, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col)); + + if (hovered) + GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col)); + PopStyleColor(); IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);