function(value, increment, minValue, maxValue) {
        var newValue = value,
            m;

        if (!(increment && value)) {
            return value;
        }
        m = value % increment;
        if (m !== 0) {
            newValue -= m;
            if (m * 2 >= increment) {
                newValue += increment;
            } else if (m * 2 < -increment) {
                newValue -= increment;
            }
        }
        return Ext.Number.constrain(newValue, minValue,  maxValue);
    }
function(value, increment, minValue, maxValue) {
        var newValue = value,
            m;

        if (!(increment && value)) {
            return value;
        }
        m = value % increment;
        if (m !== 0) {
            newValue -= m;
            if (m * 2 >= increment) {
                newValue += increment;
            } else if (m * 2 < -increment) {
                newValue -= increment;
            }
        }
        return Ext.Number.constrain(newValue, minValue,  maxValue);
    }
function ( value , increment , minValue , maxValue ) { var newValue = value , m ; if ( ! ( increment && value ) ) { return value ; } m = value % increment ; if ( m !== 0 ) { newValue -= m ; if ( m * 2 >= increment ) { newValue += increment ; } else if ( m * 2 < - increment ) { newValue -= increment ; } } return Ext . Number . constrain ( newValue , minValue , maxValue ) ; }
Snaps the passed number between stopping points based upon a passed increment value.
@param {Number} value The unsnapped value.
@param {Number} increment The increment by which the value must move.
@param {Number} minValue The minimum value to which the returned value must be constrained. Overrides the increment..
@param {Number} maxValue The maximum value to which the returned value must be constrained. Overrides the increment..
@return {Number} The value of the nearest snap target.
Snaps the passed number between stopping points based upon a passed increment value .