clamp on return

This commit is contained in:
spatialfree 2022-10-31 04:53:59 -04:00
parent f2e0f69267
commit 695b77894b

View file

@ -286,14 +286,13 @@ public class Design {
float value = PullRequest.Clamp(float.Parse(str), min, max); float value = PullRequest.Clamp(float.Parse(str), min, max);
// if clamped, update string // if clamped, update string
if (value != float.Parse(str)) { if (value != float.Parse(str)) {
// if (str.Contains(".")) { if (Input.Key(Key.Return).IsJustActive()) {
// str = ""; str = value.ToString();
// } }
str = value.ToString();
} }
return value * unit; return value * unit;
} catch { } catch {
return 0; return MathF.Max(0, min) * unit;
} }
} }
} }