Returns the x and y coordinates for the given slider value.
(slider: MatSlider, value: number)
| 2122 | |
| 2123 | /** Returns the x and y coordinates for the given slider value. */ |
| 2124 | function getCoordsForValue(slider: MatSlider, value: number): Point { |
| 2125 | const {min, max} = slider; |
| 2126 | const percent = (value - min) / (max - min); |
| 2127 | |
| 2128 | const {top, left, width, height} = slider._elementRef.nativeElement.getBoundingClientRect(); |
| 2129 | const x = width * percent + left; |
| 2130 | const y = top + height / 2; |
| 2131 | |
| 2132 | return {x, y}; |
| 2133 | } |
no test coverage detected
searching dependent graphs…