Files
一组处理数字的实用静态方法集合。
检查给定的数值是否在约束的范围内。 If the number is already within the 如果再范围内就返回此数值。否则,如果大于最大值则返回最大值,如果小于最小值则返回最小值。, otherwise the min or max value is returned depending on which side of the range is 注意本方法不改变给定的数值本身。 Note that this method returns the constrained value but does not change the current number.
The constrained value if outside the range, otherwise the current value
Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if it is not.
Ext.Number.from('1.23', 1); // returns 1.23
Ext.Number.from('abc', 1); // returns 1
value, if numeric, defaultValue otherwise
Snaps the passed number between stopping points based upon a passed increment value.
The difference between this and snapInRange is that snapInRange uses the minValue when calculating snap points:
r = Ext.Number.snap(56, 2, 55, 65); // Returns 56 - snap points are zero based
r = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue
The unsnapped value.
The increment by which the value must move.
The minimum value to which the returned value must be constrained. Overrides the increment.
The maximum value to which the returned value must be constrained. Overrides the increment.
The value of the nearest snap target.
Snaps the passed number between stopping points based upon a passed increment value.
The difference between this and snap is that snap does not use the minValue when calculating snap points:
r = Ext.Number.snap(56, 2, 55, 65); // Returns 56 - snap points are zero based
r = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue
The unsnapped value.
The increment by which the value must move.
The minimum value to which the returned value must be constrained.
Defaults to: 0
The maximum value to which the returned value must be constrained.
Defaults to: Infinity
The value of the nearest snap target.