Corrected annotation image alignment rects used in positioning the popover and hit testing for selection. The alignment rects were flipped in a couple places and we were getting lucky until now.
Query for any point annotation within a slop area that extends by the maximum image dimensions in each direction, then filter by annotations whose images actually hit-test. (So to select an annotation that has a doughnut image, you have to click on the actual doughnut, not its hole.) It’s a fuzzy hit test with a four-pixel-radius slop area, so there shouldn’t be any clicking precision issues.
Clicking on an annotation while a callout is open merely closes the callout popover, so it isn’t possible to go immediately from one callout to another. Since we still want to cycle through coincident annotations, keep track of the last selected annotation ID.
Clicking on a visible point annotation whose center is out of the visible bounds now selects the annotation.
Ported the callout-positioning portion of these changes to iOS. Also refactored some geometry conversion methods and removed a redundant constant.