Search Tweaks (#5767)
* Increase vibrancy of search field color. Set autofocus to only happen on fresh menu load. * Revert tooltip addition.
This commit is contained in:
@@ -496,6 +496,7 @@ void Menu::Draw() {
|
|||||||
SyncVisibilityConsoleVariable();
|
SyncVisibilityConsoleVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool freshOpen = true;
|
||||||
void Menu::DrawElement() {
|
void Menu::DrawElement() {
|
||||||
for (auto& [reason, info] : disabledMap) {
|
for (auto& [reason, info] : disabledMap) {
|
||||||
info.active = info.evaluation(info);
|
info.active = info.evaluation(info);
|
||||||
@@ -538,6 +539,7 @@ void Menu::DrawElement() {
|
|||||||
if (!popout) {
|
if (!popout) {
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
}
|
}
|
||||||
|
freshOpen = true;
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
@@ -654,13 +656,13 @@ void Menu::DrawElement() {
|
|||||||
std::string menuSearchText = "";
|
std::string menuSearchText = "";
|
||||||
if (headerSearch) {
|
if (headerSearch) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (autoFocus && ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !ImGui::IsAnyItemActive() &&
|
if (autoFocus && freshOpen) {
|
||||||
!ImGui::IsMouseClicked(0)) {
|
ImGui::SetKeyboardFocusHere();
|
||||||
ImGui::SetKeyboardFocusHere(0);
|
|
||||||
}
|
}
|
||||||
auto color = UIWidgets::ColorValues.at(menuThemeIndex);
|
auto color = UIWidgets::ColorValues.at(menuThemeIndex);
|
||||||
color.w = 0.2f;
|
color.w = 0.6f;
|
||||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, color);
|
ImGui::PushStyleColor(ImGuiCol_FrameBg, color);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
menuSearch.Draw("##search", 200.0f);
|
menuSearch.Draw("##search", 200.0f);
|
||||||
menuSearchText = menuSearch.InputBuf;
|
menuSearchText = menuSearch.InputBuf;
|
||||||
menuSearchText.erase(std::remove(menuSearchText.begin(), menuSearchText.end(), ' '), menuSearchText.end());
|
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::SameLine(headerWidth - 200.0f + style.ItemSpacing.x);
|
||||||
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "Search...");
|
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "Search...");
|
||||||
}
|
}
|
||||||
|
ImGui::PopStyleVar();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
@@ -853,6 +856,9 @@ void Menu::DrawElement() {
|
|||||||
poppedSize = ImGui::GetWindowSize();
|
poppedSize = ImGui::GetWindowSize();
|
||||||
poppedPos = ImGui::GetWindowPos();
|
poppedPos = ImGui::GetWindowPos();
|
||||||
}
|
}
|
||||||
|
if (freshOpen) {
|
||||||
|
freshOpen = false;
|
||||||
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|||||||
Reference in New Issue
Block a user