From 695b77894ba198a364cb1e382dff0f3688a62ac8 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Mon, 31 Oct 2022 04:53:59 -0400 Subject: [PATCH] clamp on return --- app/Mono.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Mono.cs b/app/Mono.cs index 637b2ff..9427c04 100644 --- a/app/Mono.cs +++ b/app/Mono.cs @@ -286,14 +286,13 @@ public class Design { float value = PullRequest.Clamp(float.Parse(str), min, max); // if clamped, update string if (value != float.Parse(str)) { - // if (str.Contains(".")) { - // str = ""; - // } - str = value.ToString(); + if (Input.Key(Key.Return).IsJustActive()) { + str = value.ToString(); + } } return value * unit; } catch { - return 0; + return MathF.Max(0, min) * unit; } } }