Sliders: value is clipped inside the frame when resizing sliders to be small.
This commit is contained in:
parent
9542f52182
commit
d58ded3acb
@ -4591,8 +4591,9 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
||||
|
||||
// Draw value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||
char value_buf[64];
|
||||
ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||
RenderText(ImVec2(slider_bb.GetCenter().x-CalcTextSize(value_buf, NULL, true).x*0.5f, frame_bb.Min.y + style.FramePadding.y), value_buf);
|
||||
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||
const ImVec2 value_text_size = CalcTextSize(value_buf, value_buf_end, true);
|
||||
RenderTextClipped(ImVec2(ImMax(frame_bb.Min.x + style.FramePadding.x, slider_bb.GetCenter().x - value_text_size.x*0.5f), frame_bb.Min.y + style.FramePadding.y), value_buf, value_buf_end, &value_text_size, frame_bb.Max);
|
||||
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, slider_bb.Min.y), label);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user