summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalkierian <malkierian@gmail.com>2025-08-28 08:59:45 -0700
committerGitHub <noreply@github.com>2025-08-28 08:59:45 -0700
commitcbd376afa9a14e2804efbb0cfd0e8aa7f98d33e7 (patch)
tree55bdc8508ce90d9be6ac8fa6482e2f785a157982
parent7b3809366575c14a23d3ca781ee9f399da5c7d48 (diff)
Search Tweaks (#5767)
* Increase vibrancy of search field color. Set autofocus to only happen on fresh menu load. * Revert tooltip addition.
-rw-r--r--soh/soh/SohGui/Menu.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/soh/soh/SohGui/Menu.cpp b/soh/soh/SohGui/Menu.cpp
index 5a609a935..98db5d239 100644
--- a/soh/soh/SohGui/Menu.cpp
+++ b/soh/soh/SohGui/Menu.cpp
@@ -496,6 +496,7 @@ void Menu::Draw() {
SyncVisibilityConsoleVariable();
}
+static bool freshOpen = true;
void Menu::DrawElement() {
for (auto& [reason, info] : disabledMap) {
info.active = info.evaluation(info);
@@ -538,6 +539,7 @@ void Menu::DrawElement() {
if (!popout) {
ImGui::PopStyleVar();
}
+ freshOpen = true;
ImGui::PopStyleColor();
ImGui::End();
return;
@@ -654,13 +656,13 @@ void Menu::DrawElement() {
std::string menuSearchText = "";
if (headerSearch) {
ImGui::SameLine();
- if (autoFocus && ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !ImGui::IsAnyItemActive() &&
- !ImGui::IsMouseClicked(0)) {
- ImGui::SetKeyboardFocusHere(0);
+ if (autoFocus && freshOpen) {
+ ImGui::SetKeyboardFocusHere();
}
auto color = UIWidgets::ColorValues.at(menuThemeIndex);
- color.w = 0.2f;
+ color.w = 0.6f;
ImGui::PushStyleColor(ImGuiCol_FrameBg, color);
+ ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
menuSearch.Draw("##search", 200.0f);
menuSearchText = menuSearch.InputBuf;
menuSearchText.erase(std::remove(menuSearchText.begin(), menuSearchText.end(), ' '), menuSearchText.end());
@@ -668,6 +670,7 @@ void Menu::DrawElement() {
ImGui::SameLine(headerWidth - 200.0f + style.ItemSpacing.x);
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "Search...");
}
+ ImGui::PopStyleVar();
ImGui::PopStyleColor();
}
ImGui::EndChild();
@@ -853,6 +856,9 @@ void Menu::DrawElement() {
poppedSize = ImGui::GetWindowSize();
poppedPos = ImGui::GetWindowPos();
}
+ if (freshOpen) {
+ freshOpen = false;
+ }
ImGui::End();
}
} // namespace Ship