(input: readonly [number, number], output: readonly [number, number])
| 1016 | |
| 1017 | // https://github.com/tmcw-up-for-adoption/simple-linear-scale/blob/master/index.js |
| 1018 | function linearScale(input: readonly [number, number], output: readonly [number, number]) { |
| 1019 | return (value: number) => { |
| 1020 | if (input[0] === input[1] || output[0] === output[1]) return output[0] |
| 1021 | const ratio = (output[1] - output[0]) / (input[1] - input[0]) |
| 1022 | return output[0] + ratio * (value - input[0]) |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | function isScrollingWithinScrollbarBounds(scrollPos: number, maxScrollPos: number) { |
| 1027 | return scrollPos > 0 && scrollPos < maxScrollPos |
no outgoing calls
no test coverage detected
searching dependent graphs…