mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-26 16:05:45 +03:00
implement SliderThickness var
This commit is contained in:
parent
ba84d2d372
commit
ac34dca220
4 changed files with 13 additions and 3 deletions
|
|
@ -1486,6 +1486,7 @@ ImGuiStyle::ImGuiStyle()
|
|||
ScrollbarPadding = 2.0f; // Padding of scrollbar grab within its frame (same for both axes)
|
||||
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.
|
||||
SliderThickness = 1.0f; // Thickness of slider background frame. From 0.0f to 1.0f
|
||||
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||
ImageRounding = 0.0f; // Rounding of Image() calls.
|
||||
ImageBorderSize = 0.0f; // Thickness of border around tabs.
|
||||
|
|
@ -1566,6 +1567,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|||
ScrollbarPadding = ImTrunc(ScrollbarPadding * scale_factor);
|
||||
GrabMinSize = ImTrunc(GrabMinSize * scale_factor);
|
||||
GrabRounding = ImTrunc(GrabRounding * scale_factor);
|
||||
SliderThickness = ImTrunc(SliderThickness * scale_factor);
|
||||
LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor);
|
||||
ImageRounding = ImTrunc(ImageRounding * scale_factor);
|
||||
ImageBorderSize = ImTrunc(ImageBorderSize * scale_factor);
|
||||
|
|
@ -3634,6 +3636,7 @@ static const ImGuiStyleVarInfo GStyleVarsInfo[] =
|
|||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarPadding) }, // ImGuiStyleVar_ScrollbarPadding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, SliderThickness) }, // ImGuiStyleVar_SliderThickness
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageRounding) }, // ImGuiStyleVar_ImageRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageBorderSize) }, // ImGuiStyleVar_ImageBorderSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
||||
|
|
|
|||
2
imgui.h
2
imgui.h
|
|
@ -1838,6 +1838,7 @@ enum ImGuiStyleVar_
|
|||
ImGuiStyleVar_ScrollbarPadding, // float ScrollbarPadding
|
||||
ImGuiStyleVar_GrabMinSize, // float GrabMinSize
|
||||
ImGuiStyleVar_GrabRounding, // float GrabRounding
|
||||
ImGuiStyleVar_SliderThickness, // float SliderThickness
|
||||
ImGuiStyleVar_ImageRounding, // float ImageRounding
|
||||
ImGuiStyleVar_ImageBorderSize, // float ImageBorderSize
|
||||
ImGuiStyleVar_TabRounding, // float TabRounding
|
||||
|
|
@ -2309,6 +2310,7 @@ struct ImGuiStyle
|
|||
float ScrollbarPadding; // Padding of scrollbar grab within its frame (same for both axes).
|
||||
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 SliderThickness; //
|
||||
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||
float ImageRounding; // Rounding of Image() calls.
|
||||
float ImageBorderSize; // Thickness of border around Image() calls.
|
||||
|
|
|
|||
|
|
@ -8443,6 +8443,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||
SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
||||
SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
||||
SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
|
||||
SliderFloat("SliderThickness", &style.SliderThickness, 0.1f, 1.0f, "%.3f");
|
||||
|
||||
SeparatorText("Borders");
|
||||
SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, max_border_size, "%.0f");
|
||||
|
|
|
|||
|
|
@ -3337,10 +3337,12 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|||
// Draw frame
|
||||
const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
||||
RenderNavCursor(frame_bb, id);
|
||||
RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, false, style.FrameRounding);
|
||||
const float frame_thickness = frame_bb.Max.y - frame_bb.Min.y;
|
||||
const ImRect bg_frame_bb(ImVec2(frame_bb.Min.x, frame_bb.Min.y + frame_thickness / 2 - style.SliderThickness * frame_thickness / 2), ImVec2(frame_bb.Max.x, frame_bb.Max.y - frame_thickness / 2 + style.SliderThickness * frame_thickness / 2));
|
||||
RenderFrame(bg_frame_bb.Min, bg_frame_bb.Max, frame_col, false, style.FrameRounding);
|
||||
if (color_marker != 0 && style.ColorMarkerSize > 0.0f)
|
||||
RenderColorComponentMarker(frame_bb, GetColorU32(color_marker), style.FrameRounding);
|
||||
RenderFrameBorder(frame_bb.Min, frame_bb.Max, g.Style.FrameRounding);
|
||||
RenderFrameBorder(bg_frame_bb.Min, bg_frame_bb.Max, g.Style.FrameRounding);
|
||||
|
||||
// Slider behavior
|
||||
ImRect grab_bb;
|
||||
|
|
@ -3492,7 +3494,9 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
|
|||
// Draw frame
|
||||
const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
||||
RenderNavCursor(frame_bb, id);
|
||||
RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);
|
||||
const float frame_thickness = frame_bb.Max.x - frame_bb.Min.x;
|
||||
const ImRect bg_frame_bb(ImVec2(frame_bb.Min.x + frame_thickness / 2 - style.SliderThickness * frame_thickness / 2, frame_bb.Min.y), ImVec2(frame_bb.Max.x - frame_thickness / 2 + style.SliderThickness * frame_thickness / 2, frame_bb.Max.y));
|
||||
RenderFrame(bg_frame_bb.Min, bg_frame_bb.Max, frame_col, true, g.Style.FrameRounding);
|
||||
|
||||
// Slider behavior
|
||||
ImRect grab_bb;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue