mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-02 19:42:35 +00:00
Tooltips: tooltips have a maximum size corresponding to host display/monitor size.
This commit is contained in:
@@ -93,6 +93,10 @@ Other changes:
|
||||
in a certain order. (#8595, #8250)
|
||||
- Tabs: fixes small issues with how "..." ellipsis moved depending on visibility
|
||||
of Close Button or Unsaved Document marker. (#8387)
|
||||
- Tooltips: tooltips have a maximum size corresponding to host display/monitor size,
|
||||
which mitigates edge case issues in multi-viewport scenarios where abnormally large
|
||||
windows (e.g. determined programmatically) can lead to renderer backend trying to
|
||||
create abnormally large framebuffers.
|
||||
- Nav: fixed assertion when holding gamepad FaceLeft/West button to open
|
||||
CTRL+Tab windowing + pressing a keyboard key. (#8525)
|
||||
- Error Handling: added better error report and recovery for extraneous
|
||||
|
||||
11
imgui.cpp
11
imgui.cpp
@@ -6398,16 +6398,19 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont
|
||||
const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y;
|
||||
ImVec2 size_pad = window->WindowPadding * 2.0f;
|
||||
ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars);
|
||||
|
||||
// Determine maximum window size
|
||||
// Child windows are layed within their parent (unless they are also popups/menus) and thus have no restriction
|
||||
ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
|
||||
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
||||
{
|
||||
// Tooltip always resize
|
||||
return size_desired;
|
||||
// Tooltip always resize (up to maximum size)
|
||||
return ImMin(size_desired, size_max);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Maximum window size is determined by the viewport size or monitor size
|
||||
ImVec2 size_min = CalcWindowMinSize(window);
|
||||
ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
ImVec2 size_auto_fit = ImClamp(size_desired, ImMin(size_min, size_max), size_max);
|
||||
|
||||
// FIXME: CalcWindowAutoFitSize() doesn't take into account that only one axis may be auto-fit when calculating scrollbars,
|
||||
|
||||
Reference in New Issue
Block a user