-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Annotation tap gesture recognizer queries hard-coded region, ignoring image sizes #1504
Comments
Can you get more specific about how close nearby annotations are visually, what point you are tapping (as logged in debug) and how that compares to the annotation you were trying to tap? Because annotations are in GL and aren't actual tappable views, we are querying a fuzzy region around the user's tap to try to guess which annotations they are referring to, as well as iterating overlapping annotations like MapKit does to enable selection of obscured markers. mapbox-gl-native/platform/ios/MGLMapView.mm Lines 993 to 1117 in 44cb91c
In addition, this heuristic can vary depending on marker image size, as that affects the user's perceived tappable area while not changing the region query (though we do weight the region to account for top-heavy markers). In short, this has felt good for months now, so I'm curious what changed and what the specific scenario is that is triggering this impression. |
More background: #1037 (comment) |
I'm testing on device using the Emerald style and "Add 100 Points", and zooming into an area where there is only one marker. It looks like the problem is that the hitbox for the marker is about half the size of the actual marker in Emerald, so only taps on the lower half of the marker image register. |
This is probably a result then of:
Streets: Emerald: However, this highlights the difficult with the stopgap method of limiting marker imagery to the sprite sheet while simultaneously trying to minimize communications between the GL sprite parsing layer and the iOS code related to gestures. Possible solutions:
|
I'm happy to size down the marker-- do we have a threshold in mind, both for the resizing and for the documentation? |
We’ve got a hardcoded 40×60 “tolerance” for tap recognition. It looks like the sprite is a bit taller than that. (Eventually we’ll need to support markers of different sizes and enable |
I'm ok with punting on this for b1 for Emerald. |
I think this is an ok course of action. So: no further actions here for b1, assigning issue to b2. |
Again, b3 will feature point annotation improvements. |
The situation may’ve improved a little at lower zoom levels due to #1827. |
Fixed tap box blocks large/oversized markers, such as this one: Red square being an approximation of the allowed tap box. Pisa@3x.png available here. |
MGLMapView:
mbgl::AnnotationManager:
mbgl::SpriteAtlas:
|
I think we have all the parts we need here, save a possible radius-based query for annotation proximity (assisted by #1694, I'm sure), then we can:
This is relatively slow, but shouldn't be noticeable for reasonable annotation counts with regard to tap delays. I think? |
@incanus Now we have a fixed size default marker, as well as being able to directly know the size of custom markers from the bitmap, this should be implementable? I'm going to take a stab on Android. |
@incanus I realised the hit box on Android had not been updated to match the size of the new default marker. Did this get updated on iOS? |
For Android #2876 is the first part, it at least adjusts current hit box to be default marker + 10 dp on each side. Next will be to change |
Annotation images frequently have shadows or other ornamentation that shouldn’t be considered part of the hit target. The most natural way to handle this detail on iOS would be to set the image’s alignment rectangle; |
This will be fixed in #3261. |
Tapping on a point annotation in the iOS test app seems to open a callout as expected in only 15% or so of taps.
The text was updated successfully, but these errors were encountered: