mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
Merge pull request #68027 from ktxyz/window-on-top
Update sub_windows order with respect to FLAG_ALWAYS_ON_TOP
This commit is contained in:
commit
830eff64a7
@ -166,6 +166,24 @@ ViewportTexture::~ViewportTexture() {
|
||||
}
|
||||
|
||||
void Viewport::_sub_window_update_order() {
|
||||
if (gui.sub_windows.size() < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gui.sub_windows[gui.sub_windows.size() - 1].window->get_flag(Window::FLAG_ALWAYS_ON_TOP)) {
|
||||
int index = gui.sub_windows.size() - 1;
|
||||
|
||||
while (index > 0 && gui.sub_windows[index - 1].window->get_flag(Window::FLAG_ALWAYS_ON_TOP)) {
|
||||
--index;
|
||||
}
|
||||
|
||||
if (index != (gui.sub_windows.size() - 1)) {
|
||||
SubWindow sw = gui.sub_windows[gui.sub_windows.size() - 1];
|
||||
gui.sub_windows.remove_at(gui.sub_windows.size() - 1);
|
||||
gui.sub_windows.insert(index, sw);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < gui.sub_windows.size(); i++) {
|
||||
RS::get_singleton()->canvas_item_set_draw_index(gui.sub_windows[i].canvas_item, i);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user