mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 15:50:25 +01:00
Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)
Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial.
This commit is contained in:
parent
3fde445b91
commit
a3667f462a
18
imgui.cpp
18
imgui.cpp
@ -4365,11 +4365,15 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer)
|
||||
}
|
||||
}
|
||||
|
||||
// Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)
|
||||
static void AddRootWindowToDrawData(ImGuiWindow* window)
|
||||
static inline int GetWindowDisplayLayer(ImGuiWindow* window)
|
||||
{
|
||||
int layer = (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;
|
||||
AddWindowToDrawData(window, layer);
|
||||
return (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;
|
||||
}
|
||||
|
||||
// Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)
|
||||
static inline void AddRootWindowToDrawData(ImGuiWindow* window)
|
||||
{
|
||||
AddWindowToDrawData(window, GetWindowDisplayLayer(window));
|
||||
}
|
||||
|
||||
void ImDrawDataBuilder::FlattenIntoSingleLayer()
|
||||
@ -6763,6 +6767,12 @@ bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent,
|
||||
bool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
// It would be saner to ensure that display layer is always reflected in the g.Windows[] order, which would likely requires altering all manipulations of that array
|
||||
const int display_layer_delta = GetWindowDisplayLayer(potential_above) - GetWindowDisplayLayer(potential_below);
|
||||
if (display_layer_delta != 0)
|
||||
return display_layer_delta > 0;
|
||||
|
||||
for (int i = g.Windows.Size - 1; i >= 0; i--)
|
||||
{
|
||||
ImGuiWindow* candidate_window = g.Windows[i];
|
||||
|
Loading…
Reference in New Issue
Block a user