clickable-rail-debug.js revision 34fdaac0f4e44371745512e507385385dfeb6246
919N/A * Adds support for mouse interaction with the Slider rail triggering thumb 919N/A * @submodule clickable-rail 919N/A * Slider extension that allows clicking on the Slider's rail element, 830N/A * triggering the thumb to align with the location of the click. 830N/A // Prototype methods added to host class 830N/A * Initializes the internal state and sets up events. 830N/A * @method _initClickableRail 830N/A * Broadcasts when the rail has received a mousedown event and 830N/A * triggers the thumb positioning. Use 830N/A * <code>e.preventDefault()</code> or 830N/A * <code>set("clickableRail", false)</code> to prevent 830N/A * the thumb positioning. 830N/A * @preventable _defRailMouseDownFn 830N/A * Attaches DOM event subscribers to support rail interaction. 830N/A * @method _bindClickableRail 830N/A * @method _unbindClickableRail 830N/A * Dispatches the railMouseDown event. 830N/A * @method _onRailMouseDown 830N/A * @param e {DOMEvent} the mousedown event object 830N/A if (
this.
get(
'clickableRail') && !
this.
get(
'disabled')) {
830N/A * Default behavior for the railMouseDown event. Centers the thumb at 830N/A * the click location and passes control to the DDM to behave as though 830N/A * the thumb itself were clicked in preparation for a drag operation. 830N/A * @method _defRailMouseDownFn 830N/A * @param e {Event} the EventFacade for the railMouseDown custom event 830N/A // Logic that determines which thumb should be used is abstracted 830N/A // to someday support multi-thumb sliders 830N/A // Step 1. Allow for aligning to thumb center or edge, etc 830N/A // Step 2. Remove page offsets to give just top/left style val 830N/A // Step 3. Constrain within the rail in case of attempt to 830N/A // center the thumb when clicking on the end of the rail 830N/A // Set e.target for DD's IE9 patch which calls 830N/A // e.target._node.setCapture() to allow imgs to be dragged. 830N/A // Without this, setCapture is called from the rail and rail 830N/A // clicks on other Sliders may have their thumb movements 830N/A // overridden by a different Slider (the thumb on the wrong 830N/A // Delegate to DD's natural behavior 830N/A // TODO: this won't trigger a slideEnd if the rail is clicked 830N/A // check if dd._move(e); dd._dragThreshMet = true; dd.start(); 830N/A // will do the trick. Is that even a good idea? 830N/A * Resolves which thumb to actuate if any. Override this if you want to 830N/A * support multiple thumbs. By default, returns the Drag instance for 830N/A * the thumb stored by the Slider. 830N/A * @method _resolveThumb 830N/A * @param e {DOMEvent} the mousedown event object 830N/A * @return {DD.Drag} the Drag instance that should be moved 830N/A /* Temporary workaround 830N/A var primaryOnly = this._dd.get('primaryButtonOnly'), 830N/A validClick = !primaryOnly || e.button <= 1; 830N/A return (validClick) ? this._dd : null; 830N/A * Calculates the top left position the thumb should be moved to to 830N/A * align the click XY with the center of the specified node. 830N/A * @method _getThumbDestination 830N/A * @param e {DOMEvent} The mousedown event object 830N/A * @param node {Node} The node to position 830N/A * @return {Array} the [top, left] pixel position of the destination 830N/A // Static properties added onto host class 830N/A * Enable or disable clickable rail support. 830N/A * @attribute clickableRail