mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 13:00:11 -07:00
Fix Search Crash from Scrolling (#5571)
* Fix search crashing when section child scrolled too far. * clang
This commit is contained in:
parent
ad850e50b1
commit
0b9fe2d9b9
1 changed files with 28 additions and 26 deletions
|
@ -185,8 +185,8 @@ bool ModernMenuHeaderEntry(std::string label) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
|
uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
|
||||||
ImGui::BeginChild("Search Results");
|
|
||||||
int searchCount = 0;
|
int searchCount = 0;
|
||||||
|
if (ImGui::BeginChild("Search Results")) {
|
||||||
for (auto& menuLabel : menuOrder) {
|
for (auto& menuLabel : menuOrder) {
|
||||||
auto& menuEntry = menuEntries.at(menuLabel);
|
auto& menuEntry = menuEntries.at(menuLabel);
|
||||||
for (auto& sidebarLabel : menuEntry.sidebarOrder) {
|
for (auto& sidebarLabel : menuEntry.sidebarOrder) {
|
||||||
|
@ -208,7 +208,8 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
|
||||||
if (widgetStr.find(menuSearchText) != std::string::npos) {
|
if (widgetStr.find(menuSearchText) != std::string::npos) {
|
||||||
MenuDrawItem(info, 90 / sidebar.columnCount, menuThemeIndex);
|
MenuDrawItem(info, 90 / sidebar.columnCount, menuThemeIndex);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray));
|
ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray));
|
||||||
std::string origin = fmt::format(" ({} -> {}, Col {})", menuEntry.label, sidebarLabel, i + 1);
|
std::string origin =
|
||||||
|
fmt::format(" ({} -> {}, Col {})", menuEntry.label, sidebarLabel, i + 1);
|
||||||
ImGui::Text("%s", origin.c_str());
|
ImGui::Text("%s", origin.c_str());
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
searchCount++;
|
searchCount++;
|
||||||
|
@ -217,6 +218,7 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return searchCount;
|
return searchCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue