mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Scrollbar, Style: added style.ScrollbarPadding, ImGuiStyleVar_ScrollbarPadding. (#8895)
This commit is contained in:
parent
89b7fc906a
commit
42656b3aa1
5 changed files with 14 additions and 3 deletions
|
|
@ -43,6 +43,8 @@ Breaking Changes:
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Scrollbar, Style: added configurable style.ScrollbarPadding value and corresponding
|
||||||
|
ImGuiStyleVar_ScrollbarPadding enum, instead of hardcoded computed default. (#8895)
|
||||||
- DrawList: Fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
|
- DrawList: Fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
|
||||||
pointer, which could to issue when deleting the cloned list. (#8894, #1860)
|
pointer, which could to issue when deleting the cloned list. (#8894, #1860)
|
||||||
- Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam]
|
- Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam]
|
||||||
|
|
|
||||||
|
|
@ -1413,6 +1413,7 @@ ImGuiStyle::ImGuiStyle()
|
||||||
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
||||||
ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
|
ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
|
||||||
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
||||||
|
ScrollbarPadding = 2.0f; // Padding of scrollbar grab within its frame (same for both axises)
|
||||||
GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar
|
GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar
|
||||||
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||||
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||||
|
|
@ -1482,6 +1483,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||||
ColumnsMinSpacing = ImTrunc(ColumnsMinSpacing * scale_factor);
|
ColumnsMinSpacing = ImTrunc(ColumnsMinSpacing * scale_factor);
|
||||||
ScrollbarSize = ImTrunc(ScrollbarSize * scale_factor);
|
ScrollbarSize = ImTrunc(ScrollbarSize * scale_factor);
|
||||||
ScrollbarRounding = ImTrunc(ScrollbarRounding * scale_factor);
|
ScrollbarRounding = ImTrunc(ScrollbarRounding * scale_factor);
|
||||||
|
ScrollbarPadding = ImTrunc(ScrollbarPadding * scale_factor);
|
||||||
GrabMinSize = ImTrunc(GrabMinSize * scale_factor);
|
GrabMinSize = ImTrunc(GrabMinSize * scale_factor);
|
||||||
GrabRounding = ImTrunc(GrabRounding * scale_factor);
|
GrabRounding = ImTrunc(GrabRounding * scale_factor);
|
||||||
LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor);
|
LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor);
|
||||||
|
|
@ -3503,6 +3505,7 @@ static const ImGuiStyleVarInfo GStyleVarsInfo[] =
|
||||||
{ 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, CellPadding) }, // ImGuiStyleVar_CellPadding
|
{ 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, CellPadding) }, // ImGuiStyleVar_CellPadding
|
||||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize
|
||||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding
|
||||||
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarPadding) }, // ImGuiStyleVar_ScrollbarPadding
|
||||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
||||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
||||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageBorderSize) }, // ImGuiStyleVar_ImageBorderSize
|
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageBorderSize) }, // ImGuiStyleVar_ImageBorderSize
|
||||||
|
|
|
||||||
2
imgui.h
2
imgui.h
|
|
@ -1805,6 +1805,7 @@ enum ImGuiStyleVar_
|
||||||
ImGuiStyleVar_CellPadding, // ImVec2 CellPadding
|
ImGuiStyleVar_CellPadding, // ImVec2 CellPadding
|
||||||
ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize
|
ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize
|
||||||
ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding
|
ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding
|
||||||
|
ImGuiStyleVar_ScrollbarPadding, // float ScrollbarPadding
|
||||||
ImGuiStyleVar_GrabMinSize, // float GrabMinSize
|
ImGuiStyleVar_GrabMinSize, // float GrabMinSize
|
||||||
ImGuiStyleVar_GrabRounding, // float GrabRounding
|
ImGuiStyleVar_GrabRounding, // float GrabRounding
|
||||||
ImGuiStyleVar_ImageBorderSize, // float ImageBorderSize
|
ImGuiStyleVar_ImageBorderSize, // float ImageBorderSize
|
||||||
|
|
@ -2271,6 +2272,7 @@ struct ImGuiStyle
|
||||||
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
||||||
float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar.
|
float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar.
|
||||||
float ScrollbarRounding; // Radius of grab corners for scrollbar.
|
float ScrollbarRounding; // Radius of grab corners for scrollbar.
|
||||||
|
float ScrollbarPadding; // Padding of scrollbar grab within its frame (same for both axises).
|
||||||
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar.
|
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar.
|
||||||
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||||
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||||
|
|
|
||||||
|
|
@ -8325,7 +8325,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||||
SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
||||||
SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
||||||
SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
||||||
SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
|
||||||
SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
|
SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
|
||||||
|
|
||||||
SeparatorText("Borders");
|
SeparatorText("Borders");
|
||||||
|
|
@ -8339,9 +8338,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||||
SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f");
|
SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f");
|
||||||
SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f");
|
SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f");
|
||||||
SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
||||||
SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
|
||||||
SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
||||||
|
|
||||||
|
SeparatorText("Scrollbar");
|
||||||
|
SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
||||||
|
SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
||||||
|
SliderFloat("ScrollbarPadding", &style.ScrollbarPadding, 0.0f, 10.0f, "%.0f");
|
||||||
|
|
||||||
SeparatorText("Tabs");
|
SeparatorText("Tabs");
|
||||||
SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
|
SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
|
||||||
SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f");
|
SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f");
|
||||||
|
|
|
||||||
|
|
@ -1026,7 +1026,8 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
|
||||||
const bool allow_interaction = (alpha >= 1.0f);
|
const bool allow_interaction = (alpha >= 1.0f);
|
||||||
|
|
||||||
ImRect bb = bb_frame;
|
ImRect bb = bb_frame;
|
||||||
bb.Expand(ImVec2(-ImClamp(IM_TRUNC((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_TRUNC((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
float padding = IM_TRUNC(ImMin(style.ScrollbarPadding, ImMin(bb_frame_width, bb_frame_height) * 0.5f));
|
||||||
|
bb.Expand(-padding);
|
||||||
|
|
||||||
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
||||||
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue