///Credit brogan89 ///Sourced from - https://github.com/brogan89/MinMaxSlider using System; namespace UnityEngine.UI.Extensions { [Serializable] public struct MinMaxValues { /// /// Floating point tolerance /// public const float FLOAT_TOL = 0.01f; public float minValue, maxValue, minLimit, maxLimit; public static MinMaxValues DEFUALT = new MinMaxValues(25, 75, 0, 100); public MinMaxValues(float minValue, float maxValue, float minLimit, float maxLimit) { this.minValue = minValue; this.maxValue = maxValue; this.minLimit = minLimit; this.maxLimit = maxLimit; } /// /// Constructor for when values equal limits /// /// /// public MinMaxValues(float minValue, float maxValue) { this.minValue = minValue; this.maxValue = maxValue; this.minLimit = minValue; this.maxLimit = maxValue; } public bool IsAtMinAndMax() { return Math.Abs(minValue - minLimit) < FLOAT_TOL && Math.Abs(maxValue - maxLimit) < FLOAT_TOL; } public override string ToString() { return $"Values(min:{minValue}, max:{maxValue}) | Limits(min:{minLimit}, max:{maxLimit})"; } } }