mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internals: BringWindowToFront() iterate front to back, faster in majority of use cases.
This commit is contained in:
parent
3d24a9eb40
commit
2874aabb93
@ -5123,10 +5123,10 @@ void ImGui::BringWindowToFront(ImGuiWindow* window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.Windows.back() == window)
|
if (g.Windows.back() == window)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < g.Windows.Size; i++)
|
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window
|
||||||
if (g.Windows[i] == window)
|
if (g.Windows[i] == window)
|
||||||
{
|
{
|
||||||
g.Windows.erase(g.Windows.begin() + i);
|
g.Windows.erase(g.Windows.Data + i);
|
||||||
g.Windows.push_back(window);
|
g.Windows.push_back(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user