16011N/A * Adds value support for Slider as a range of integers between a configured 11904N/A * minimum and maximum value. For use with <code>Y.Base.build(..)</code> to 11904N/A * add the plumbing to <code>Y.SliderBase</code>. 11904N/A * @submodule slider-value-range 11904N/A// Constants for compression or performance 11904N/A * One class of value algorithm that can be built onto SliderBase. By default, 11904N/A * values range between 0 and 100, but you can configure these on the 17593N/A * built Slider class by setting the <code>min</code> and <code>max</code> 17593N/A * configurations. Set the initial value (will cause the thumb to move to the 17593N/A * appropriate location on the rail) in configuration as well if appropriate. 11904N/A // Prototype properties and methods that will be added onto host class 11904N/A * Factor used to translate value -> position -> value. 17593N/A * Stub for construction logic. Override if extending this class and 11904N/A * you need to set something up during the initializer phase. 11904N/A * @method _initSliderValueRange 17593N/A * Override of stub method in SliderBase that is called at the end of 11904N/A * its bindUI stage of render(). Subscribes to internal events to 11904N/A * trigger UI and related state updates. 11904N/A * Move the thumb to appropriate position if necessary. Also resets 11904N/A * the cached offsets and recalculates the conversion factor to 17593N/A * (range between max and min) / (rail length) 17593N/A * for fast runtime calculation of position -> value. 17593N/A // The default thumb width is based on Sam skin's thumb dimension. 15995N/A // This attempts to allow for rendering off-DOM, then attaching 11904N/A // without the need to call syncUI(). It is still recommended 11904N/A // to call syncUI() in these cases though, just to be sure. 15995N/A * Dispatch the new position of the thumb into the value setting 17593N/A * @param e { EventFacade } The host's thumbMove event 17593N/A // To prevent set('value', x) from looping back around 17593N/A * <p>Converts a pixel position into a value. Calculates current 17593N/A * thumb offset from the leading edge of the rail multiplied by the 17593N/A * ratio of <code>(max - min) / (constraining dim)</code>.</p> 17593N/A * <p>Override this if you want to use a different value mapping 11904N/A * @param offset { Number } X or Y pixel offset 11904N/A * @return { mixed } Value corresponding to the provided pixel offset 17593N/A * Converts a value into a pixel offset for use in positioning 17593N/A * the thumb according to the reverse of the 11904N/A * <code>_offsetToValue( xy )</code> operation. 11904N/A * @param val { Number } The value to map to pixel X or Y position 17593N/A * @return { Number } The pixel offset 15981N/A * Returns the current value. Override this if you want to introduce 11904N/A * output formatting. Otherwise equivalent to slider.get( "value" ); * Updates the current value. Override this if you want to introduce * input value parsing or preprocessing. Otherwise equivalent to * slider.set( "value", v ); * @param val {Number} The new value * Update position according to new min value. If the new min results * in the current value being out of range, the value is set to the * @method _afterMinChange * @param e { EventFacade } The <code>min</code> attribute change event. * Update position according to new max value. If the new max results * in the current value being out of range, the value is set to the * @method _afterMaxChange * @param e { EventFacade } The <code>max</code> attribute change event. * Verifies that the current value is within the min - max range. If * not, value is set to either min or max, depending on which is // @TODO Can/should valueChange, minChange, etc be queued // events? To make dd.set( 'min', n ); execute after minChange // subscribers before on/after valueChange subscribers. * Propagate change to the thumb position unless the change originated * from the thumbMove event. * @method _afterValueChange * @param e { EventFacade } The <code>valueChange</code> event. Y.
log(
"Positioning thumb after set('value',x)",
"info",
"slider");
* Positions the thumb in accordance with the translated value. * @param value {Number} Value to translate to a pixel position * @param [options] {Object} Details object to pass to `_uiMoveThumb` * Validates new values assigned to <code>min</code> attribute. Numbers * are acceptable. Override this to enforce different rules. * @method _validateNewMin * @param value {Any} Value assigned to <code>min</code> attribute. * @return {Boolean} True for numbers. False otherwise. * Validates new values assigned to <code>max</code> attribute. Numbers * are acceptable. Override this to enforce different rules. * @method _validateNewMax * @param value { mixed } Value assigned to <code>max</code> attribute. * @return { Boolean } True for numbers. False otherwise. * Restricts new values assigned to <code>value</code> attribute to be * between the configured <code>min</code> and <code>max</code>. * Rounds to nearest integer value. * @param value { Number } Value assigned to <code>value</code> attribute * @return { Number } Normalized and constrained value * Returns the nearest valid value to the value input. If the provided * value is outside the min - max range, accounting for min > max * scenarios, the nearest of either min or max is returned. Otherwise, * the provided value is returned. * @param value { mixed } Value to test against current min - max range * @return { Number } Current min, max, or value if within range // Account for reverse value range (min > max) * Attributes that will be added onto host class. * The value associated with the farthest top, left position of the * rail. Can be greater than the configured <code>max</code> if you * want values to increase from right-to-left or bottom-to-top. * The value associated with the farthest bottom, right position of * the rail. Can be less than the configured <code>min</code> if * you want values to increase from right-to-left or bottom-to-top. * when the page up/down keys are pressed * The value associated with the thumb's current position on the * rail. Defaults to the value inferred from the thumb's current * position. Specifying value in the constructor will move the * thumb to the position that corresponds to the supplied value. * @default (inferred from current thumb position) },
'@VERSION@' ,{
requires:[
'slider-base']});