/// <summary>
        /// Converts a string to a float.
        /// </summary>
        /// <param name="str">The string to convert.</param>
        /// <returns>The float parsed from the string.</returns>
        protected override float StringToValue(string str)
        {
            double v;

            UINumericFieldsUtils.StringToDouble(str, out v);
            return(Mathf.ClampToFloat(v));
        }
            public override void ApplyInputDeviceDelta(Vector3 delta, DeltaSpeed speed, float startValue)
            {
                double sensitivity  = NumericFieldDraggerUtility.CalculateFloatDragSensitivity(startValue);
                float  acceleration = NumericFieldDraggerUtility.Acceleration(speed == DeltaSpeed.Fast, speed == DeltaSpeed.Slow);
                double v            = StringToValue(text);

                v += NumericFieldDraggerUtility.NiceDelta(delta, acceleration) * sensitivity;
                v  = Mathf.RoundBasedOnMinimumDifference(v, sensitivity);
                if (parentFloatField.isDelayed)
                {
                    text = ValueToString(Mathf.ClampToFloat(v));
                }
                else
                {
                    parentFloatField.value = Mathf.ClampToFloat(v);
                }
            }
Exemple #3
0
 internal static float ClampToFloat(double value)
 {
     return(Mathf.ClampToFloat(value));
 }