Slider: Fix drag move at same value

Slider: Fix drag move at same value | code style

Slider: Fix drag move at same value | code style

Slider: Fix drag move at same value | code style
This commit is contained in:
Jan Galek 2016-08-30 11:10:55 +02:00
parent d7ea031bd3
commit 72057ac4b3

View File

@ -76,6 +76,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
this._detectOrientation();
this._mouseInit();
this._calculateNewMax();
this._originalVal;
this._addClass( "ui-slider ui-slider-" + this.orientation,
"ui-widget ui-widget-content" );
@ -227,6 +228,8 @@ return $.widget( "ui.slider", $.ui.mouse, {
( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
};
this._originalVal = this.values();
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
this._slide( event, index, normValue );
}
@ -242,6 +245,14 @@ return $.widget( "ui.slider", $.ui.mouse, {
var position = { x: event.pageX, y: event.pageY },
normValue = this._normValueFromMouse( position );
if ( this._originalVal[ 0 ] === this._originalVal[ 1 ] &&
normValue > this._originalVal[ 0 ] ) {
this._handleIndex = 1;
} else if ( this._originalVal[ 0 ] === this._originalVal[ 1 ] &&
normValue < this._originalVal[ 0 ] ) {
this._handleIndex = 0;
}
this._slide( event, this._handleIndex, normValue );
return false;