11@import ' default-theme' ;
22
3- $slider-size : 20px !default ;
3+ // This refers to the thickness of the slider. On a horizontal slider this is the height, on a
4+ // vertical slider this is the width.
5+ $slider-thickness : 20px !default ;
46$slider-min-size : 128px !default ;
57
68$slider-track-height : 2px !default ;
7- $slider-thumb-width : 20px !default ;
8- $slider-thumb-height : $slider-thumb-width !default ;
9+ $slider-thumb-size : 20px !default ;
910
1011$slider-thumb-default-scale : 0.7 !default ;
1112$slider-thumb-focus-scale : 1 !default ;
@@ -15,20 +16,26 @@ $slider-off-color: rgba(black, 0.26);
1516$slider-focused-color : rgba (black , 0.38 );
1617$slider-disabled-color : rgba (black , 0.26 );
1718
18- @function center-vertically ($outerHeight , $innerHeight ) {
19- @return ($outerHeight / 2 ) - ($innerHeight / 2 );
19+ /* *
20+ * Uses a container height and an item height to center an item vertically within the container.
21+ */
22+ @function center-vertically ($containerHeight , $itemHeight ) {
23+ @return ($containerHeight / 2 ) - ($itemHeight / 2 );
2024}
2125
22- @mixin slider-thumb-position ($width : $slider-thumb-width , $height : $slider-thumb-height ) {
26+ /* *
27+ * Positions the thumb based on its width and height.
28+ */
29+ @mixin slider-thumb-position ($width : $slider-thumb-size , $height : $slider-thumb-size ) {
2330 position : absolute ;
24- top : center-vertically ($slider-size , $height );
31+ top : center-vertically ($slider-thickness , $height );
2532 width : $width ;
2633 height : $height ;
2734 border-radius : max ($width , $height );
2835}
2936
3037md-slider {
31- height : $slider-size ;
38+ height : $slider-thickness ;
3239 min-width : $slider-min-size ;
3340 position : relative ;
3441 padding : 0 ;
@@ -42,21 +49,29 @@ md-slider *::after {
4249 box-sizing : border-box ;
4350}
4451
52+ /* *
53+ * Exists in order to pad the slider and keep everything positioned correctly.
54+ * Cannot be merged with the .md-slider-container.
55+ */
4556.md-slider-wrapper {
4657 width : 100% ;
4758 height : 100% ;
4859 padding-left : 8px ;
4960 padding-right : 8px ;
5061}
5162
63+ /* *
64+ * Holds the isActive and isDragging classes as well as help with positioning the children.
65+ * Cannot be merged with .md-slider-wrapper.
66+ */
5267.md-slider-container {
5368 position : relative ;
5469}
5570
5671.md-slider-track-container {
5772 width : 100% ;
5873 position : absolute ;
59- top : center-vertically ($slider-size , $slider-track-height );
74+ top : center-vertically ($slider-thickness , $slider-track-height );
6075 height : $slider-track-height ;
6176}
6277
@@ -92,17 +107,17 @@ md-slider *::after {
92107.md-slider-thumb {
93108 z-index : 1 ;
94109
95- @include slider-thumb-position ($slider-thumb-width , $slider-thumb-height );
110+ @include slider-thumb-position ($slider-thumb-size , $slider-thumb-size );
96111 transform : scale ($slider-thumb-default-scale );
97112 transition : transform 400ms cubic-bezier (0.25 , 0.8 , 0.25 , 1 );
98113}
99114
100115.md-slider-thumb ::after {
101116 content : ' ' ;
102117 position : absolute ;
103- width : $slider-thumb-width ;
104- height : $slider-thumb-height ;
105- border-radius : max ($slider-thumb-width , $slider-thumb-height );
118+ width : $slider-thumb-size ;
119+ height : $slider-thumb-size ;
120+ border-radius : max ($slider-thumb-size , $slider-thumb-size );
106121 border-width : 3px ;
107122 border-style : solid ;
108123 transition : inherit ;
0 commit comments