Want more features on Pastebin? Sign Up, it's FREE!
Guest

jQuery UI Slider Overlapping Handles Patch

By: a guest on Apr 17th, 2013  |  syntax: Diff  |  size: 1.04 KB  |  views: 90  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --- jquery-ui/development-bundle/ui/jquery.ui.slider.js Tue Apr 16 09:08:44 2013
  2. +++ jquery-ui/development-bundle/ui/jquery.ui.slider.patched.js Wed Apr 17 10:33:27 2013
  3. @@ -46,6 +46,7 @@
  4.                 this._mouseSliding = false;
  5.                 this._animateOff = true;
  6.                 this._handleIndex = null;
  7. +               this._chooseHandle = null;
  8.                 this._detectOrientation();
  9.                 this._mouseInit();
  10.  
  11. @@ -218,13 +219,24 @@
  12.         },
  13.  
  14.         _mouseStart: function() {
  15. +               var values = this.values();
  16. +              
  17. +               this._chooseHandle = ( this.handles.length === 2 ) && ( values[0] === values[1] );
  18. +              
  19.                 return true;
  20.         },
  21.  
  22.         _mouseDrag: function( event ) {
  23.                 var position = { x: event.pageX, y: event.pageY },
  24. -                       normValue = this._normValueFromMouse( position );
  25. -
  26. +                       normValue = this._normValueFromMouse( position ),
  27. +                       values = this.values();
  28. +              
  29. +               if ( this._chooseHandle && ( normValue !== values[0] ) )
  30. +               {
  31. +                       this._handleIndex = normValue < values[0] ? 0 : 1;
  32. +                       this._chooseHandle = false;
  33. +               }
  34. +              
  35.                 this._slide( event, this._handleIndex, normValue );
  36.  
  37.                 return false;
clone this paste RAW Paste Data