@@ -23,7 +23,7 @@ $.widget("ui.slider", $.ui.mouse, {
2323 widgetEventPrefix : "slide" ,
2424 options : {
2525 animate : false ,
26- distance : 0 ,
26+ distance : 1 ,
2727 max : 100 ,
2828 min : 0 ,
2929 orientation : 'horizontal' ,
@@ -53,6 +53,8 @@ $.widget("ui.slider", $.ui.mouse, {
5353 this . element . addClass ( 'ui-slider-disabled ui-disabled' ) ;
5454 }
5555
56+ o . distance = o . orientation == 'horizontal' ? { x :o . distance , y :0 } : ( o . orientation == "vertical" ? { x :0 , y :o . distance } : o . distance ) ;
57+
5658 this . range = $ ( [ ] ) ;
5759
5860 if ( o . range ) {
@@ -228,7 +230,7 @@ $.widget("ui.slider", $.ui.mouse, {
228230 return this ;
229231 } ,
230232
231- _mouseCapture : function ( event ) {
233+ _mouseStart : function ( event , orgEvent ) {
232234
233235 var o = this . options ;
234236
@@ -255,17 +257,13 @@ $.widget("ui.slider", $.ui.mouse, {
255257 }
256258 } ) ;
257259
258- // workaround for bug #3736 (if both handles of a range are at 0,
259- // the first is always used as the one with least distance,
260- // and moving it is obviously prevented by preventing negative ranges)
261- if ( o . range == true ) {
262- var vals = this . values ( )
263- if ( vals [ 1 ] == o . min ) {
264- closestHandle = $ ( this . handles [ ++ index ] ) ;
265- }
266- if ( vals [ 0 ] == vals [ 1 ] ) {
267- this . _stackedHandles = true ;
268- }
260+ // workaround for bug #3736 (if both handles of a range are stacked,
261+ // figure out which way they are moving and use that handle)
262+ if ( o . range == true && this . values ( 0 ) == this . values ( 1 ) &&
263+ ( ( o . orientation == 'horizontal' && ( event . pageX < orgEvent . pageX ) )
264+ || ( o . orientation == "vertical" && ( event . pageY > orgEvent . pageY ) ) ) ) {
265+ index = 1 ;
266+ closestHandle = $ ( this . handles [ index ] ) ;
269267 }
270268
271269 this . _start ( event , index ) ;
@@ -295,10 +293,6 @@ $.widget("ui.slider", $.ui.mouse, {
295293
296294 } ,
297295
298- _mouseStart : function ( event ) {
299- return true ;
300- } ,
301-
302296 _mouseDrag : function ( event ) {
303297
304298 var position = { x : event . pageX , y : event . pageY } ;
@@ -374,23 +368,6 @@ $.widget("ui.slider", $.ui.mouse, {
374368 _slide : function ( event , index , newVal ) {
375369
376370 var handle = this . handles [ index ] ;
377-
378- // Handle the case were range handles are stacked
379- if ( this . options . range == true && this . _stackedHandles ) {
380- var values = this . values ( ) ;
381- if ( values [ 1 ] != newVal ) {
382- if ( values [ 1 ] > newVal ) {
383- index = 0 ;
384- } else if ( values [ 1 ] < newVal ) {
385- index = 1 ;
386- }
387- this . _stackedHandles = false ;
388- this . handles . removeClass ( "ui-state-active" ) ;
389- handle = this . handles [ index ] ;
390- $ ( handle ) . addClass ( "ui-state-active" ) . focus ( ) ;
391- this . _handleIndex = index ;
392- }
393- }
394371
395372 if ( this . options . values && this . options . values . length ) {
396373
0 commit comments