mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
Fixed InputScalar, InputScalarN, SliderScalarN, DragScalarN with non-visible label from inserting style.ItemInnerSpacing.x worth of trailing spacing.
This commit is contained in:
parent
7bc03f7155
commit
3fda90d6a7
@ -41,6 +41,8 @@ Other Changes:
|
||||
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
|
||||
- Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect
|
||||
but it breaks existing some layout patterns. Will return back to it when we expose Separator flags.
|
||||
- Fixed InputScalar, InputScalarN, SliderScalarN, DragScalarN with non-visible label from inserting
|
||||
style.ItemInnerSpacing.x worth of trailing spacing.
|
||||
- Fixed InputFloatX, SliderFloatX, DragFloatX functions erroneously reporting IsItemEdited() multiple
|
||||
times when the text input doesn't match the formatted output value (e.g. input "1" shows "1.000").
|
||||
It wasn't much of a problem because we typically use the return value instead of IsItemEdited() here.
|
||||
|
@ -2068,15 +2068,22 @@ bool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* v, int
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
if (i > 0)
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
value_changed |= DragScalar("", data_type, v, v_speed, v_min, v_max, format, power);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
v = (void*)((char*)v + type_size);
|
||||
}
|
||||
PopID();
|
||||
|
||||
TextEx(label, FindRenderedTextEnd(label));
|
||||
const char* label_end = FindRenderedTextEnd(label);
|
||||
if (label != label_end)
|
||||
{
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
TextEx(label, label_end);
|
||||
}
|
||||
|
||||
EndGroup();
|
||||
return value_changed;
|
||||
}
|
||||
@ -2516,15 +2523,22 @@ bool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, i
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
if (i > 0)
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
value_changed |= SliderScalar("", data_type, v, v_min, v_max, format, power);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
v = (void*)((char*)v + type_size);
|
||||
}
|
||||
PopID();
|
||||
|
||||
TextEx(label, FindRenderedTextEnd(label));
|
||||
const char* label_end = FindRenderedTextEnd(label);
|
||||
if (label != label_end)
|
||||
{
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
TextEx(label, label_end);
|
||||
}
|
||||
|
||||
EndGroup();
|
||||
return value_changed;
|
||||
}
|
||||
@ -2827,8 +2841,13 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
DataTypeApplyOp(data_type, '+', data_ptr, data_ptr, g.IO.KeyCtrl && step_fast ? step_fast : step);
|
||||
value_changed = true;
|
||||
}
|
||||
SameLine(0, style.ItemInnerSpacing.x);
|
||||
TextEx(label, FindRenderedTextEnd(label));
|
||||
|
||||
const char* label_end = FindRenderedTextEnd(label);
|
||||
if (label != label_end)
|
||||
{
|
||||
SameLine(0, style.ItemInnerSpacing.x);
|
||||
TextEx(label, label_end);
|
||||
}
|
||||
style.FramePadding = backup_frame_padding;
|
||||
|
||||
PopID();
|
||||
@ -2860,15 +2879,22 @@ bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, in
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
if (i > 0)
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
value_changed |= InputScalar("", data_type, v, step, step_fast, format, flags);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
v = (void*)((char*)v + type_size);
|
||||
}
|
||||
PopID();
|
||||
|
||||
TextEx(label, FindRenderedTextEnd(label));
|
||||
const char* label_end = FindRenderedTextEnd(label);
|
||||
if (label != label_end)
|
||||
{
|
||||
SameLine(0.0f, g.Style.ItemInnerSpacing.x);
|
||||
TextEx(label, label_end);
|
||||
}
|
||||
|
||||
EndGroup();
|
||||
return value_changed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user