mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-21 09:23:02 +08:00
Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds()
This commit is contained in:
parent
5f5ba8eb11
commit
1ab3007752
@ -151,6 +151,7 @@ Docking+Viewports Branch:
|
|||||||
to ensure a window is not parented. Previously this would use the global default (which might be 0,
|
to ensure a window is not parented. Previously this would use the global default (which might be 0,
|
||||||
but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871)
|
but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871)
|
||||||
- Viewports: Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)
|
- Viewports: Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)
|
||||||
|
- Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport.
|
||||||
- Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (#4656)
|
- Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (#4656)
|
||||||
- Disabled: Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (#4655, #4452, #4453, #4462)
|
- Disabled: Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (#4655, #4452, #4453, #4462)
|
||||||
|
|
||||||
|
22
imgui.cpp
22
imgui.cpp
@ -4664,7 +4664,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds()
|
|||||||
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
|
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
|
||||||
ImRect bb = window->Rect();
|
ImRect bb = window->Rect();
|
||||||
bb.Expand(g.FontSize);
|
bb.Expand(g.FontSize);
|
||||||
if (bb.Contains(window->Viewport->GetMainRect())) // If a window fits the entire viewport, adjust its highlight inward
|
if (!window->Viewport->GetMainRect().Contains(bb)) // If a window fits the entire viewport, adjust its highlight inward
|
||||||
{
|
{
|
||||||
bb.Expand(-g.FontSize - 1.0f);
|
bb.Expand(-g.FontSize - 1.0f);
|
||||||
rounding = window->WindowRounding;
|
rounding = window->WindowRounding;
|
||||||
@ -4704,9 +4704,6 @@ void ImGui::EndFrame()
|
|||||||
g.CurrentWindow->Active = false;
|
g.CurrentWindow->Active = false;
|
||||||
End();
|
End();
|
||||||
|
|
||||||
// Draw modal whitening background on _other_ viewports than the one the modal is one
|
|
||||||
EndFrameDrawDimmedBackgrounds();
|
|
||||||
|
|
||||||
// Update navigation: CTRL+Tab, wrap-around requests
|
// Update navigation: CTRL+Tab, wrap-around requests
|
||||||
NavEndFrame();
|
NavEndFrame();
|
||||||
|
|
||||||
@ -4736,6 +4733,9 @@ void ImGui::EndFrame()
|
|||||||
// Initiate moving window + handle left-click and right-click focus
|
// Initiate moving window + handle left-click and right-click focus
|
||||||
UpdateMouseMovingWindowEndFrame();
|
UpdateMouseMovingWindowEndFrame();
|
||||||
|
|
||||||
|
// Draw modal/window whitening backgrounds
|
||||||
|
EndFrameDrawDimmedBackgrounds();
|
||||||
|
|
||||||
// Update user-facing viewport list (g.Viewports -> g.PlatformIO.Viewports after filtering out some)
|
// Update user-facing viewport list (g.Viewports -> g.PlatformIO.Viewports after filtering out some)
|
||||||
UpdateViewportsEndFrame();
|
UpdateViewportsEndFrame();
|
||||||
|
|
||||||
@ -6743,20 +6743,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->DrawList = &window->DrawListInst;
|
window->DrawList = &window->DrawListInst;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw navigation selection/windowing rectangle border
|
|
||||||
if (g.NavWindowingTargetAnim == window)
|
|
||||||
{
|
|
||||||
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
|
|
||||||
ImRect bb = window->Rect();
|
|
||||||
bb.Expand(g.FontSize);
|
|
||||||
if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward
|
|
||||||
{
|
|
||||||
bb.Expand(-g.FontSize - 1.0f);
|
|
||||||
rounding = window->WindowRounding;
|
|
||||||
}
|
|
||||||
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, 0, 3.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)
|
// UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)
|
||||||
|
|
||||||
// Work rectangle.
|
// Work rectangle.
|
||||||
|
Loading…
Reference in New Issue
Block a user