I have a map of ships that are clustered when they are close together, unless you subsequently hover the pointer over the cluster circle. The clustering is based on this OpenLayers example:
https://openlayers.org/en/latest/examples/earthquake-clusters.html
The clustering works fine. The problem is that the map is also supposed to show popup info about the ships when you hover over their marker. This works fine for free-standing, non-clustered ships. However, when the ships are clustered, I can't figure out how to detect which, if any, ship marker is being hovered over.
When the ship markers aren't clustered I use the OpenLayers function "getFeaturesAtPixel", check if there's a ship marker among the features, and show popup info about the ship if one is found. When they are clustered, hovering over the markers inside the temporarily "expanded" cluster doesn't yield any other features but the cluster itself when calling getFeaturesAtPixel.
One possible way to solve this that I got stuck on was manually checking for the boat features when hovering over a cluster. I was trying to use Extent's "containsCoordinate" to see if the extent of the ship marker's geometry contains the coordinates of the pointer's pixel. However, the extent I get from the ship markers is basically a point value (from the Point that is used to position the marker), not the actual extent the whole icon covers.
Possible challenge that would solve this: how do you manually check if a feature covers a pixel / coordinate?