toyplot
toyplot copied to clipboard
Activating the context menu on plots is difficult.
It's hard to hit the line. We should probably be highlighting / selecting whatever is closest to the cursor.
Broadly speaking, there are a couple of options:
- Add invisible geometry that can receive mouseover events.
- Pro: just works for arbitrary complexity shapes, Bezier paths, etc.
- Con: where there's overlap, the order in which a region is chosen is fixed.
- In theory, getIntersectionList() could be used, but it's missing on Firefox and buggy elsewhere.
- Add spatial indexing such as kd trees.
- Pro: Can be used to search for nearest neighbors, no matter the scene complexity.
- Con: search for shapes other than points is trickier - at a minimum we would need nearest line segment for plots and spines, plus nearest rect for bars, plus fills.
- Looks like maybe a quad tree is what we want.