Function
lowerBoundObject
(
data: ReadonlyArray<ObjectPoint>,
xTarget: number,
)
Source from the content-addressed store, hash-verified
| 440 | }; |
| 441 | |
| 442 | const lowerBoundObject = ( |
| 443 | data: ReadonlyArray<ObjectPoint>, |
| 444 | xTarget: number, |
| 445 | ): number => { |
| 446 | let lo = 0; |
| 447 | let hi = data.length; |
| 448 | while (lo < hi) { |
| 449 | const mid = (lo + hi) >>> 1; |
| 450 | const x = data[mid].x; |
| 451 | if (x < xTarget) lo = mid + 1; |
| 452 | else hi = mid; |
| 453 | } |
| 454 | return lo; |
| 455 | }; |
| 456 | |
| 457 | /** |
| 458 | * Finds the nearest data point to the given cursor position across all series. |
Tested by
no test coverage detected