mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-02 19:16:49 +08: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)
|
in a certain order. (#8595, #8250)
|
||||||
- Tabs: fixes small issues with how "..." ellipsis moved depending on visibility
|
- Tabs: fixes small issues with how "..." ellipsis moved depending on visibility
|
||||||
of Close Button or Unsaved Document marker. (#8387)
|
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
|
- Nav: fixed assertion when holding gamepad FaceLeft/West button to open
|
||||||
CTRL+Tab windowing + pressing a keyboard key. (#8525)
|
CTRL+Tab windowing + pressing a keyboard key. (#8525)
|
||||||
- Error Handling: added better error report and recovery for extraneous
|
- Error Handling: added better error report and recovery for extraneous
|
||||||
|
|||||||
@@ -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;
|
const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y;
|
||||||
ImVec2 size_pad = window->WindowPadding * 2.0f;
|
ImVec2 size_pad = window->WindowPadding * 2.0f;
|
||||||
ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars);
|
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)
|
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
||||||
{
|
{
|
||||||
// Tooltip always resize
|
// Tooltip always resize (up to maximum size)
|
||||||
return size_desired;
|
return ImMin(size_desired, size_max);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Maximum window size is determined by the viewport size or monitor size
|
|
||||||
ImVec2 size_min = CalcWindowMinSize(window);
|
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);
|
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,
|
// 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