mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-25 17:16:35 +00:00
Tooltip always auto-resize. May look into max-over-xx-seconds policy later.
This commit is contained in:
parent
2082487366
commit
f61e8e6e26
20
imgui.cpp
20
imgui.cpp
@ -2161,7 +2161,8 @@ int ImGui::GetFrameCount()
|
|||||||
void ImGui::BeginTooltip()
|
void ImGui::BeginTooltip()
|
||||||
{
|
{
|
||||||
ImGuiState& g = GImGui;
|
ImGuiState& g = GImGui;
|
||||||
ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_Tooltip);
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_Tooltip;
|
||||||
|
ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, window_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndTooltip()
|
void ImGui::EndTooltip()
|
||||||
@ -2355,16 +2356,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
|||||||
|
|
||||||
// New windows appears in front
|
// New windows appears in front
|
||||||
if (window->LastFrameDrawn < current_frame - 1)
|
if (window->LastFrameDrawn < current_frame - 1)
|
||||||
{
|
|
||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
||||||
{
|
|
||||||
// Hide for 1 frame while resizing
|
|
||||||
window->AutoFitFrames = 2;
|
|
||||||
window->AutoFitOnlyGrows = false;
|
|
||||||
window->Visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window->LastFrameDrawn = current_frame;
|
window->LastFrameDrawn = current_frame;
|
||||||
window->ClipRectStack.resize(0);
|
window->ClipRectStack.resize(0);
|
||||||
@ -2489,11 +2481,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
|||||||
ImU32 resize_col = 0;
|
ImU32 resize_col = 0;
|
||||||
if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
||||||
{
|
{
|
||||||
// Tooltip always resize
|
// Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
|
||||||
if (window->AutoFitFrames > 0)
|
const ImVec2 size_auto_fit = window->SizeContentsFit + style.WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
|
||||||
{
|
window->SizeFull = size_auto_fit;
|
||||||
window->SizeFull = window->SizeContentsFit + style.WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user