mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-23 16:16:36 +00:00
Viewport: Fixed initial popup positioning not using the monitor area properly. (#1542)
This commit is contained in:
parent
4433ce4312
commit
f1c31ebc67
@ -6032,10 +6032,12 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Maximum window size is determined by the viewport size or monitor size
|
// Maximum window size is determined by the viewport size or monitor size
|
||||||
const int monitor_idx = window->ViewportAllowPlatformMonitorExtend;
|
|
||||||
ImVec2 avail_size = window->Viewport->Size;
|
ImVec2 avail_size = window->Viewport->Size;
|
||||||
if (window->ViewportOwned)
|
if (window->ViewportOwned)
|
||||||
avail_size = (monitor_idx >= 0 && monitor_idx < g.PlatformIO.Monitors.Size) ? (g.PlatformIO.Monitors[monitor_idx].WorkMax - g.PlatformIO.Monitors[monitor_idx].WorkMin) : ImVec2(FLT_MAX, FLT_MAX);
|
avail_size = ImVec2(FLT_MAX, FLT_MAX);
|
||||||
|
const int monitor_idx = window->ViewportAllowPlatformMonitorExtend;
|
||||||
|
if (monitor_idx >= 0 && monitor_idx < g.PlatformIO.Monitors.Size)
|
||||||
|
avail_size = (g.PlatformIO.Monitors[monitor_idx].WorkMax - g.PlatformIO.Monitors[monitor_idx].WorkMin);
|
||||||
ImVec2 size_auto_fit = ImClamp(size_contents, style.WindowMinSize, ImMax(style.WindowMinSize, avail_size - g.Style.DisplaySafeAreaPadding * 2.0f));
|
ImVec2 size_auto_fit = ImClamp(size_contents, style.WindowMinSize, ImMax(style.WindowMinSize, avail_size - g.Style.DisplaySafeAreaPadding * 2.0f));
|
||||||
|
|
||||||
// When the window cannot fit all contents (either because of constraints, either because screen is too small),
|
// When the window cannot fit all contents (either because of constraints, either because screen is too small),
|
||||||
|
Loading…
Reference in New Issue
Block a user