File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ $md-slider-disabled-color: rgba(black, 0.26);
31
31
@mixin slider-thumb-position ($width : $md-slider-thumb-size , $height : $md-slider-thumb-size ) {
32
32
position : absolute ;
33
33
top : center-vertically ($md-slider-thickness , $height );
34
+ // This makes it so that the center of the thumb aligns with where the click was.
35
+ // This is not affected by the movement of the thumb.
34
36
left : (- $width / 2 );
35
37
width : $width ;
36
38
height : $height ;
Original file line number Diff line number Diff line change @@ -203,6 +203,8 @@ export class MdSlider implements AfterContentInit {
203
203
this . _percent = this . clamp ( ( pos - offset ) / size ) ;
204
204
let exactValue = this . min + ( this . _percent * ( this . max - this . min ) ) ;
205
205
206
+ // This calculation finds the closest step by finding the closest whole number divisible by the
207
+ // step relative to the min.
206
208
this . value = Math . round ( ( exactValue - this . min ) / this . step ) * this . step + this . min ;
207
209
this . _renderer . updateThumbAndFillPosition ( this . _percent , this . _sliderDimensions . width ) ;
208
210
}
You can’t perform that action at this time.
0 commit comments