diff options
author | Juan Pablo Kaniefsky <jpkaniefsky@gmail.com> | 2012-11-13 22:05:59 -0300 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2012-11-16 09:32:56 -0500 |
commit | a18863205e060bf9a145bb5ed90e36d8feb3c8f7 (patch) | |
tree | fc49406e7115f5d518f45125deebdea59d83e5e1 /ui/jquery.ui.slider.js | |
parent | ccdceddd804458ed451b11660c161ef3cf8de5cd (diff) | |
download | jquery-ui-a18863205e060bf9a145bb5ed90e36d8feb3c8f7.tar.gz jquery-ui-a18863205e060bf9a145bb5ed90e36d8feb3c8f7.zip |
Slider: when handles overlap, clicking and dragging will now pick the last one that was moved. Fixed #3467 - Sliders Handles can overlap, only small sliver of slider is selectable
Diffstat (limited to 'ui/jquery.ui.slider.js')
-rw-r--r-- | ui/jquery.ui.slider.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 18f7113d4..90de25316 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -233,21 +233,15 @@ $.widget( "ui.slider", $.ui.mouse, { distance = this._valueMax() - this._valueMin() + 1; this.handles.each(function( i ) { var thisDistance = Math.abs( normValue - that.values(i) ); - if ( distance > thisDistance ) { + if (( distance > thisDistance ) || + ( distance === thisDistance && + (i === that._lastChangedValue || that.values(i) === o.min ))) { distance = thisDistance; closestHandle = $( this ); index = i; } }); - // workaround for bug #3736 (if both handles of a range are at 0, - // the first is always used as the one with least distance, - // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { - index += 1; - closestHandle = $( this.handles[index] ); - } - allowed = this._start( event, index ); if ( allowed === false ) { return false; @@ -419,6 +413,9 @@ $.widget( "ui.slider", $.ui.mouse, { uiHash.values = this.values(); } + //store the last changed value index for reference when handles overlap + this._lastChangedValue = index; + this._trigger( "change", event, uiHash ); } }, |