You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
getAnnotationsInBounds not returning in bounds annotations #3643
While making touch target smaller was great for selecting annotations side by side. It did make selecting annotations in general more difficult. I believe the source of this problem can be found in C++ implementation of getAnnotationsInBounds.
Visual
In next screenshot I visualised the BoundingBox passed to the getAnnotationsInBounds:
In that case an InfoWindow is not shown because getAnnotationsInBounds returns an empty list.
As mentioned in the follow up ticket, we should look into fixing this at the Android SDK level by introducing appropriate padding. We used to do fixed padding but that is not the way iOS or OS X are handling this.
I initially wanted to manage this in IconFactory, but this will indicate the average will be used in all maps in one application. The average should only be used per map.
After changing the default marker image, the markers are placed to low on the map.
To workaround this I used setTopOffsetPixels with the height of the marker.
In the same way an end developer would do.
The idea here is to add a fixed amount of padding + an average padding calculated from all the different icons used. For the default icon (that has extra whitespace to work around not having the anchor method from #2916) I'm just subtracting the whitespace from it before calculating the average padding (iOS is doing the same).
Activity
tobrun commentedon Jan 21, 2016
Let's take a trip down to C++ land and figure this out:
getAnnotationsInBounds()is callingnativeGetAnnotationsInBounds()in jni.cppnativeGetAnnotationsInBounds()is callinggetMap().getPointAnnotationsInBounds()on native_map_view.cpp / map.cppgetPointsAnnotationsInBounds()is callinggetPointAnnotationsInBoundsin annotation_manager.cppThe code above is used for all annotations and doesn't take in account the height/width of a Marker icon.
tobrun commentedon Mar 3, 2016
As mentioned in the follow up ticket, we should look into fixing this at the Android SDK level by introducing appropriate padding. We used to do fixed padding but that is not the way iOS or OS X are handling this.
tobrun commentedon Mar 5, 2016
To resolve above I will calculate the average width and average height of a marker icon and take that in account when calculation the touch area.
tobrun commentedon Mar 5, 2016
I initially wanted to manage this in IconFactory, but this will indicate the average will be used in all maps in one application. The average should only be used per map.
tobrun commentedon Mar 5, 2016
I'm starting to understand why I was not really able to get the same ux with the default marker vs custom:
This should be changed to a
normalimage as a end developer would also use.tobrun commentedon Mar 5, 2016
After changing the default marker image, the markers are placed to low on the map.
To workaround this I used
setTopOffsetPixelswith the height of the marker.In the same way an end developer would do.
tobrun commentedon Mar 5, 2016
It seems I'm currently not able to use setTopOffsetPixels.. this is one adjustment needed for dynamic marker support.
tobrun commentedon Mar 5, 2016
Since there are a lot of moving pieces and this fits more in the story of
4.1.0, I'm going to postpone this.[android] #3643 - dynamic padding on touch surfaces for marker selection
[android] mapbox#4243 mapbox#3643 - refactoring the onSingleTapConfir…
[android] mapbox#4243 mapbox#3643 - refactoring the onSingleTapConfir…
vfaSonnt commentedon Mar 31, 2016
Hope this will be released soon.
tobrun commentedon Apr 6, 2016
The idea here is to add a fixed amount of padding + an average padding calculated from all the different icons used. For the default icon (that has extra whitespace to work around not having the anchor method from #2916) I'm just subtracting the whitespace from it before calculating the average padding (iOS is doing the same).
tobrun commentedon Apr 6, 2016
The calculated padding in action:
https://www.dropbox.com/s/f6do1utnqdad4sm/device-2016-04-06-121147.mp4?dl=0
and the side-by-side selection in action:
https://www.dropbox.com/s/h8knv67kz7qkrlk/device-2016-04-06-121603.mp4?dl=0