Usinig entityNearestByXThenY causes some weird behaviour - if the cursor is marginally closer in the x domain to another point than the one the user intended to click on, that point will be the one that gets selected - even if it is hundreds of pixels away in the y domain.
Even worse, the tooltip-on-hover codepath just uses entityNearest(), so the intuitive nearest point has a tooltip, but then clicking selects a different point.
I went through the git history and couldn't see any reason why the "by x then y" approach was taken, but may well be missing something.
Hovering showing the nearest point:
After clicking at that exact same cursor location:
After this PR, the selected point is the expected one.
Usinig
entityNearestByXThenY
causes some weird behaviour - if the cursor is marginally closer in the x domain to another point than the one the user intended to click on, that point will be the one that gets selected - even if it is hundreds of pixels away in the y domain.Even worse, the tooltip-on-hover codepath just uses
entityNearest()
, so the intuitive nearest point has a tooltip, but then clicking selects a different point.I went through the git history and couldn't see any reason why the "by x then y" approach was taken, but may well be missing something.
Hovering showing the nearest point:![image](https://user-images.githubusercontent.com/1652335/96299530-1a20fc80-0fec-11eb-89dc-fa1ae6cdd242.png)
After clicking at that exact same cursor location:![image](https://user-images.githubusercontent.com/1652335/96299607-37ee6180-0fec-11eb-9a0c-75208f663f3a.png)
After this PR, the selected point is the expected one.