mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Slider: Fix line length issues
Ref gh-1690
This commit is contained in:
parent
e1f23184a6
commit
b6b4dd1279
@ -274,10 +274,12 @@ return $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
|
|
||||||
if ( this.orientation === "horizontal" ) {
|
if ( this.orientation === "horizontal" ) {
|
||||||
pixelTotal = this.elementSize.width;
|
pixelTotal = this.elementSize.width;
|
||||||
pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
|
pixelMouse = position.x - this.elementOffset.left -
|
||||||
|
( this._clickOffset ? this._clickOffset.left : 0 );
|
||||||
} else {
|
} else {
|
||||||
pixelTotal = this.elementSize.height;
|
pixelTotal = this.elementSize.height;
|
||||||
pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
|
pixelMouse = position.y - this.elementOffset.top -
|
||||||
|
( this._clickOffset ? this._clickOffset.top : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
percentMouse = ( pixelMouse / pixelTotal );
|
percentMouse = ( pixelMouse / pixelTotal );
|
||||||
@ -595,23 +597,38 @@ return $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
|
|
||||||
if ( this._hasMultipleValues() ) {
|
if ( this._hasMultipleValues() ) {
|
||||||
this.handles.each( function( i ) {
|
this.handles.each( function( i ) {
|
||||||
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
|
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
|
||||||
|
that._valueMin() ) * 100;
|
||||||
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
||||||
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
||||||
if ( that.options.range === true ) {
|
if ( that.options.range === true ) {
|
||||||
if ( that.orientation === "horizontal" ) {
|
if ( that.orientation === "horizontal" ) {
|
||||||
if ( i === 0 ) {
|
if ( i === 0 ) {
|
||||||
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
|
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
left: valPercent + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
if ( i === 1 ) {
|
if ( i === 1 ) {
|
||||||
that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
that.range[ animate ? "animate" : "css" ]( {
|
||||||
|
width: ( valPercent - lastValPercent ) + "%"
|
||||||
|
}, {
|
||||||
|
queue: false,
|
||||||
|
duration: o.animate
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( i === 0 ) {
|
if ( i === 0 ) {
|
||||||
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
|
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
bottom: ( valPercent ) + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
if ( i === 1 ) {
|
if ( i === 1 ) {
|
||||||
that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
that.range[ animate ? "animate" : "css" ]( {
|
||||||
|
height: ( valPercent - lastValPercent ) + "%"
|
||||||
|
}, {
|
||||||
|
queue: false,
|
||||||
|
duration: o.animate
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,16 +645,24 @@ return $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
||||||
|
|
||||||
if ( oRange === "min" && this.orientation === "horizontal" ) {
|
if ( oRange === "min" && this.orientation === "horizontal" ) {
|
||||||
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
|
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
width: valPercent + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
||||||
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, o.animate );
|
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
width: ( 100 - valPercent ) + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
if ( oRange === "min" && this.orientation === "vertical" ) {
|
if ( oRange === "min" && this.orientation === "vertical" ) {
|
||||||
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
|
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
height: valPercent + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
if ( oRange === "max" && this.orientation === "vertical" ) {
|
if ( oRange === "max" && this.orientation === "vertical" ) {
|
||||||
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, o.animate );
|
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||||
|
height: ( 100 - valPercent ) + "%"
|
||||||
|
}, o.animate );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user