Fixed integer displays in script editor

This commit is contained in:
Simon Lübeß
2026-09-13 21:56:17 +02:00
parent 8e9efbb367
commit fff1abf012
+4 -4
View File
@@ -282,10 +282,10 @@ internal class EntityEditor
if (value is float || value is double || value is Half) if (value is float || value is double || value is Half)
format = "0.#####"; format = "0.#####";
else else
format = "0"; format = null;
} }
if (!format.StartsWith("%")) if (format?.StartsWith("%") == false)
{ {
if (value is float f) if (value is float f)
{ {
@@ -303,14 +303,14 @@ internal class EntityEditor
if (range?.Slider == true) if (range?.Slider == true)
{ {
if (ImGui.SliderScalar(fieldId, dataType, (IntPtr)(&value), (IntPtr)(&min), (IntPtr)(&max), format)) if (ImGui.SliderScalar(fieldId, dataType, (IntPtr)(&value), (IntPtr)(&min), (IntPtr)(&max), format, flags: ImGuiSliderFlags.AlwaysClamp))
{ {
newValue = value; newValue = value;
} }
} }
else else
{ {
if (ImGui.DragScalar(fieldId, dataType, (IntPtr)(&value), dragSpeed, (IntPtr)(&min), (IntPtr)(&max), format)) if (ImGui.DragScalar(fieldId, dataType, (IntPtr)(&value), dragSpeed, (IntPtr)(&min), (IntPtr)(&max), format, flags: ImGuiSliderFlags.AlwaysClamp))
{ {
newValue = value; newValue = value;
} }