mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Window: Fixed one case where auto-resize by double-clicking the resize grip would make either scrollbar appear for a single frame after the resize. Moved Scrollbar visibility block.
This commit is contained in:
parent
300d8dd656
commit
c96f2c4057
@ -42,6 +42,8 @@ Other Changes:
|
|||||||
will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding.
|
will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding.
|
||||||
The exact meaning of ContentSize for decorated windows was previously ill-defined.
|
The exact meaning of ContentSize for decorated windows was previously ill-defined.
|
||||||
- Window: Fixed auto-resize with AlwaysVerticalScrollbar or AlwaysHorizontalScrollbar flags.
|
- Window: Fixed auto-resize with AlwaysVerticalScrollbar or AlwaysHorizontalScrollbar flags.
|
||||||
|
- Window: Fixed one case where auto-resize by double-clicking the resize grip would make either scrollbar
|
||||||
|
appear for a single frame after the resize.
|
||||||
- Columns: Fixed Separator from creating an extraneous draw command. (#125)
|
- Columns: Fixed Separator from creating an extraneous draw command. (#125)
|
||||||
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
|
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
|
||||||
- Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect
|
- Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect
|
||||||
|
20
imgui.cpp
20
imgui.cpp
@ -1077,7 +1077,7 @@ static int FindWindowFocusIndex(ImGuiWindow* window);
|
|||||||
// Misc
|
// Misc
|
||||||
static void UpdateMouseInputs();
|
static void UpdateMouseInputs();
|
||||||
static void UpdateMouseWheel();
|
static void UpdateMouseWheel();
|
||||||
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
static bool UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
||||||
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
||||||
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);
|
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);
|
||||||
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
||||||
@ -4829,15 +4829,18 @@ static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle resize for: Resize Grips, Borders, Gamepad
|
// Handle resize for: Resize Grips, Borders, Gamepad
|
||||||
static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4])
|
// Return true when using auto-fit (double click on resize grip)
|
||||||
|
static bool ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4])
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindowFlags flags = window->Flags;
|
ImGuiWindowFlags flags = window->Flags;
|
||||||
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
|
||||||
return;
|
|
||||||
if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
||||||
|
return false;
|
||||||
|
if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool ret_auto_fit = false;
|
||||||
const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0;
|
const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0;
|
||||||
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
||||||
const float grip_hover_inner_size = (float)(int)(grip_draw_size * 0.75f);
|
const float grip_hover_inner_size = (float)(int)(grip_draw_size * 0.75f);
|
||||||
@ -4871,6 +4874,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
|||||||
{
|
{
|
||||||
// Manual auto-fit when double-clicking
|
// Manual auto-fit when double-clicking
|
||||||
size_target = CalcSizeAfterConstraint(window, size_auto_fit);
|
size_target = CalcSizeAfterConstraint(window, size_auto_fit);
|
||||||
|
ret_auto_fit = true;
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
}
|
}
|
||||||
else if (held)
|
else if (held)
|
||||||
@ -4945,6 +4949,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
|||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
||||||
|
|
||||||
window->Size = window->SizeFull;
|
window->Size = window->SizeFull;
|
||||||
|
return ret_auto_fit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& rect, const ImVec2& padding)
|
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& rect, const ImVec2& padding)
|
||||||
@ -5478,7 +5483,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
const int resize_grip_count = g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // 4
|
const int resize_grip_count = g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // 4
|
||||||
const float resize_grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
const float resize_grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
||||||
if (!window->Collapsed)
|
if (!window->Collapsed)
|
||||||
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
if (UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]))
|
||||||
|
use_current_size_for_scrollbar_x = use_current_size_for_scrollbar_y = true;
|
||||||
window->ResizeBorderHeld = (signed char)border_held;
|
window->ResizeBorderHeld = (signed char)border_held;
|
||||||
|
|
||||||
// SCROLLBAR VISIBILITY
|
// SCROLLBAR VISIBILITY
|
||||||
|
Loading…
Reference in New Issue
Block a user