mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-14 00:34:18 +00:00
Add ImGuiStyleVar_DockingSeparatorSize + misc Docking related comments.
This commit is contained in:
parent
a5aff5fd3e
commit
b79751ebad
4 changed files with 34 additions and 19 deletions
16
imgui.cpp
16
imgui.cpp
|
|
@ -1184,7 +1184,7 @@ ImGuiStyle::ImGuiStyle()
|
|||
SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
||||
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
||||
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||
DockingSplitterSize = 2.0f; // Thickness of border/padding between docked windows
|
||||
DockingSeparatorSize = 2.0f; // Thickness of resizing border between docked windows
|
||||
MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
|
||||
AntiAliasedLines = true; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.
|
||||
AntiAliasedLinesUseTex = true; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
|
||||
|
|
@ -1228,6 +1228,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|||
TabRounding = ImFloor(TabRounding * scale_factor);
|
||||
TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
|
||||
SeparatorTextPadding = ImFloor(SeparatorTextPadding * scale_factor);
|
||||
DockingSeparatorSize = ImFloor(DockingSeparatorSize * scale_factor);
|
||||
DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
|
||||
DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
|
||||
MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);
|
||||
|
|
@ -3151,6 +3152,7 @@ static const ImGuiDataVarInfo GStyleVarInfo[] =
|
|||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextBorderSize) },// ImGuiStyleVar_SeparatorTextBorderSize
|
||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextAlign) }, // ImGuiStyleVar_SeparatorTextAlign
|
||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextPadding) }, // ImGuiStyleVar_SeparatorTextPadding
|
||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, DockingSeparatorSize) }, // ImGuiStyleVar_DockingSeparatorSize
|
||||
};
|
||||
|
||||
const ImGuiDataVarInfo* ImGui::GetStyleVarInfo(ImGuiStyleVar idx)
|
||||
|
|
@ -15294,7 +15296,7 @@ void ImGui::DockContextEndFrame(ImGuiContext* ctx)
|
|||
if (node->LastFrameActive == g.FrameCount && node->IsVisible && node->HostWindow && node->IsLeafNode() && !node->IsBgDrawnThisFrame)
|
||||
{
|
||||
ImRect bg_rect(node->Pos + ImVec2(0.0f, GetFrameHeight()), node->Pos + node->Size);
|
||||
ImDrawFlags bg_rounding_flags = CalcRoundingFlagsForRectInRect(bg_rect, node->HostWindow->Rect(), g.Style.DockingSplitterSize);
|
||||
ImDrawFlags bg_rounding_flags = CalcRoundingFlagsForRectInRect(bg_rect, node->HostWindow->Rect(), g.Style.DockingSeparatorSize);
|
||||
node->HostWindow->DrawList->ChannelsSetCurrent(DOCKING_HOST_DRAW_CHANNEL_BG);
|
||||
node->HostWindow->DrawList->AddRectFilled(bg_rect.Min, bg_rect.Max, node->LastBgColor, node->HostWindow->WindowRounding, bg_rounding_flags);
|
||||
}
|
||||
|
|
@ -16767,7 +16769,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
|||
if (is_focused)
|
||||
node->LastFrameFocused = g.FrameCount;
|
||||
ImU32 title_bar_col = GetColorU32(host_window->Collapsed ? ImGuiCol_TitleBgCollapsed : is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
|
||||
ImDrawFlags rounding_flags = CalcRoundingFlagsForRectInRect(title_bar_rect, host_window->Rect(), g.Style.DockingSplitterSize);
|
||||
ImDrawFlags rounding_flags = CalcRoundingFlagsForRectInRect(title_bar_rect, host_window->Rect(), g.Style.DockingSeparatorSize);
|
||||
host_window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, host_window->WindowRounding, rounding_flags);
|
||||
|
||||
// Docking/Collapse button
|
||||
|
|
@ -17249,7 +17251,7 @@ static void ImGui::DockNodePreviewDockRender(ImGuiWindow* host_window, ImGuiDock
|
|||
overlay_rect.Min.y += GetFrameHeight();
|
||||
if (data->SplitDir != ImGuiDir_None || data->IsCenterAvailable)
|
||||
for (int overlay_n = 0; overlay_n < overlay_draw_lists_count; overlay_n++)
|
||||
overlay_draw_lists[overlay_n]->AddRectFilled(overlay_rect.Min, overlay_rect.Max, overlay_col_main, host_window->WindowRounding, CalcRoundingFlagsForRectInRect(overlay_rect, host_window->Rect(), g.Style.DockingSplitterSize));
|
||||
overlay_draw_lists[overlay_n]->AddRectFilled(overlay_rect.Min, overlay_rect.Max, overlay_col_main, host_window->WindowRounding, CalcRoundingFlagsForRectInRect(overlay_rect, host_window->Rect(), g.Style.DockingSeparatorSize));
|
||||
}
|
||||
|
||||
// Display tab shape/label preview unless we are splitting node (it generally makes the situation harder to read)
|
||||
|
|
@ -17366,7 +17368,7 @@ void ImGui::DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
|
|||
parent_node->VisibleWindow = NULL;
|
||||
parent_node->AuthorityForPos = parent_node->AuthorityForSize = ImGuiDataAuthority_DockNode;
|
||||
|
||||
float size_avail = (parent_node->Size[split_axis] - g.Style.DockingSplitterSize);
|
||||
float size_avail = (parent_node->Size[split_axis] - g.Style.DockingSeparatorSize);
|
||||
size_avail = ImMax(size_avail, g.Style.WindowMinSize[split_axis] * 2.0f);
|
||||
IM_ASSERT(size_avail > 0.0f); // If you created a node manually with DockBuilderAddNode(), you need to also call DockBuilderSetNodeSize() before splitting.
|
||||
child_0->SizeRef = child_1->SizeRef = parent_node->Size;
|
||||
|
|
@ -17447,6 +17449,7 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
|
|||
{
|
||||
// During the regular dock node update we write to all nodes.
|
||||
// 'only_write_to_single_node' is only set when turning a node visible mid-frame and we need its size right-away.
|
||||
ImGuiContext& g = *GImGui;
|
||||
const bool write_to_node = only_write_to_single_node == NULL || only_write_to_single_node == node;
|
||||
if (write_to_node)
|
||||
{
|
||||
|
|
@ -17469,8 +17472,7 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
|
|||
|
||||
if (child_0_is_or_will_be_visible && child_1_is_or_will_be_visible)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
const float spacing = g.Style.DockingSplitterSize;
|
||||
const float spacing = g.Style.DockingSeparatorSize;
|
||||
const ImGuiAxis axis = (ImGuiAxis)node->SplitAxis;
|
||||
const float size_avail = ImMax(size[axis] - spacing, 0.0f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue