Skip to content

fix: Account for marker size when picking the hovered WebGL point - #8170

Open
adimalkar wants to merge 4 commits into
plotly:mainfrom
adimalkar:fix/8082-gl-hover-marker-size
Open

adimalkar wants to merge 4 commits into
plotly:mainfrom
adimalkar:fix/8082-gl-hover-marker-size

Conversation

@adimalkar

Copy link
Copy Markdown

This PR makes scattergl, scatterpolargl and splom use marker size when they pick the hovered point, as scatter does.

Closes #8082.

Why this is correct

  • scatter scores a point by its distance to the marker edge. Inside a marker, a smaller marker wins.
  • scattergl and splom measured only the distance to the marker center. So the marker drawn on top always won.
  • This PR moves the existing scatter math into getAxisDistance and getPointDistance in scatter/hover.js, with no change in behavior.