()
| 122 | }; |
| 123 | |
| 124 | const getTrackWidthPx = (): number | null => { |
| 125 | // getBoundingClientRect() is robust even if the container is scaled. |
| 126 | const w = track.getBoundingClientRect().width; |
| 127 | return Number.isFinite(w) && w > 0 ? w : null; |
| 128 | }; |
| 129 | |
| 130 | const pxToPercent = (dxPx: number): number | null => { |
| 131 | const w = getTrackWidthPx(); |