mirror of
https://github.com/ocornut/imgui.git
synced 2026-07-05 09:05:20 +00:00
Merge branch 'master' into docking
This commit is contained in:
21
imgui.cpp
21
imgui.cpp
@@ -1561,6 +1561,8 @@ ImGuiStyle::ImGuiStyle()
|
||||
TreeLinesFlags = ImGuiTreeNodeFlags_DrawLinesNone;
|
||||
TreeLinesSize = 1.0f; // Thickness of outlines when using ImGuiTreeNodeFlags_DrawLines.
|
||||
TreeLinesRounding = 0.0f; // Radius of lines connecting child nodes to the vertical line.
|
||||
MenuItemRounding = 0.0f; // Radius of MenuItem, BeginMenu rounding.
|
||||
SelectableRounding = 0.0f; // Radius of selectable rounding. MODIFYING THIS IS DISCOURAGED. CONTIGUOUS SELECTIONS WILL NOT LOOK RIGHT. (#7589)
|
||||
DragDropTargetRounding = 0.0f; // Radius of the drag and drop target frame.
|
||||
DragDropTargetBorderSize = 2.0f; // Thickness of the drag and drop target border.
|
||||
DragDropTargetPadding = 3.0f; // Size to expand the drag and drop target from actual target item size.
|
||||
@@ -1642,6 +1644,8 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||
TabBarOverlineSize = ImTrunc(TabBarOverlineSize * scale_factor);
|
||||
TreeLinesSize = ImTrunc(TreeLinesSize * scale_factor);
|
||||
TreeLinesRounding = ImTrunc(TreeLinesRounding * scale_factor);
|
||||
MenuItemRounding = ImTrunc(MenuItemRounding * scale_factor);
|
||||
SelectableRounding = ImTrunc(SelectableRounding * scale_factor);
|
||||
DragDropTargetRounding = ImTrunc(DragDropTargetRounding * scale_factor);
|
||||
DragDropTargetBorderSize = ImTrunc(DragDropTargetBorderSize * scale_factor);
|
||||
DragDropTargetPadding = ImTrunc(DragDropTargetPadding * scale_factor);
|
||||
@@ -3756,6 +3760,8 @@ static const ImGuiStyleVarInfo GStyleVarsInfo[] =
|
||||
{ 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TableAngledHeadersTextAlign)},// ImGuiStyleVar_TableAngledHeadersTextAlign
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TreeLinesSize)}, // ImGuiStyleVar_TreeLinesSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TreeLinesRounding)}, // ImGuiStyleVar_TreeLinesRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, MenuItemRounding)}, // ImGuiStyleVar_MenuItemRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, SelectableRounding)}, // ImGuiStyleVar_SelectableRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, DragDropTargetRounding)}, // ImGuiStyleVar_DragDropTargetRounding
|
||||
{ 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
||||
{ 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
||||
@@ -4100,7 +4106,7 @@ void ImGui::RenderColorComponentMarker(const ImRect& bb, ImU32 col, float roundi
|
||||
RenderRectFilledInRangeH(window->DrawList, bb, col, bb.Min.x, ImMin(bb.Min.x + g.Style.ColorMarkerSize, bb.Max.x), rounding);
|
||||
}
|
||||
|
||||
void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFlags flags)
|
||||
void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFlags flags, float rounding)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (id != g.NavId)
|
||||
@@ -4116,17 +4122,24 @@ void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFl
|
||||
if (window->DC.NavHideHighlightOneFrame)
|
||||
return;
|
||||
|
||||
float rounding = (flags & ImGuiNavRenderCursorFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
if (rounding < 0.0f && (flags & ImGuiNavRenderCursorFlags_NoRounding))
|
||||
rounding = 0.0f;
|
||||
#endif
|
||||
if (rounding < 0.0f)
|
||||
rounding = g.Style.FrameRounding;
|
||||
|
||||
ImRect display_rect = bb;
|
||||
display_rect.ClipWith(window->ClipRect);
|
||||
const float thickness = 2.0f;
|
||||
const float scale_factor = GetScale(); // FIXME-DPI
|
||||
const float thickness = (float)(int)ImMax(2.0f, 1.5f * scale_factor);
|
||||
if (flags & ImGuiNavRenderCursorFlags_Compact)
|
||||
{
|
||||
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, thickness);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float distance = 3.0f + thickness * 0.5f;
|
||||
const float distance = (float)(int)(3.0f + thickness * 0.5f);
|
||||
display_rect.Expand(ImVec2(distance, distance));
|
||||
bool fully_visible = window->ClipRect.Contains(display_rect);
|
||||
if (!fully_visible)
|
||||
|
||||
Reference in New Issue
Block a user