Compute data hover using voronoi diagram
billyjanitsch opened this issue · comments
Billy Janitsch commented
Profiling the stress test in #123, I noticed that 40% of each frame is spent calling isPointInStroke
to compute which datum the mouse is hovering over. (This use of isPointInStroke
is also the only reason that orama requires a polyfill to support IE 11, AFAIK.)
Instead of this canvas-based approach, we could collapse all data into a voronoi diagram, and use it to determine the closest datum to a given mouse position, which would be relatively instantaneous. Here's an example of that approach.
(This would change the existing hover behavior, arguably for the better.)