Returns the x and y coordinates for the given slider value.
(slider: MatSlider, value: number)
| 2156 | |
| 2157 | /** Returns the x and y coordinates for the given slider value. */ |
| 2158 | function getCoordsForValue(slider: MatSlider, value: number): Point { |
| 2159 | const {min, max} = slider; |
| 2160 | const percent = (value - min) / (max - min); |
| 2161 | |
| 2162 | const {top, left, width, height} = slider._elementRef.nativeElement.getBoundingClientRect(); |
| 2163 | const x = width * percent + left; |
| 2164 | const y = top + height / 2; |
| 2165 | |
| 2166 | return {x, y}; |
| 2167 | } |
no test coverage detected