-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fit to supplied markers #386
Fit to supplied markers #386
Conversation
@@ -53,6 +53,7 @@ | |||
| `animateToRegion` | `region: Region`, `duration: Number` | | |||
| `animateToCoordinate` | `region: Coordinate`, `duration: Number` | | |||
| `fitToElements` | `animated: Boolean` | | |||
| `fitToSpecifiedMarkers` | `markerIDs: String[]` | | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fitToSuppliedMarkers
@AidenMontgomery Thanks for redoing the PR! Looks good to me but I haven't gotten a chance to test it. /cc @jrichardlai @lelandrichardson @felipecsl I think we should get this merged in. |
if (feature instanceof AirMapMarker) { | ||
String identifier = ((AirMapMarker)feature).getIdentifier(); | ||
Marker marker = (Marker)feature.getFeature(); | ||
if (Arrays.asList(markerIDs).contains(identifier)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract Arrays.asList(markerIDs)
as a variable outside of the loop so you dont allocate a new array every time
looks good to me with minor nits 👍 |
Thanks for the feedback. I will make the changes and do some more testing this evening, then update the PR. |
…on for fitToSuppliedMarkers
I haven't tested this on Android yet, but I have run the example project on the iOS Simulator and I think that it looks ok. I am going to try and get it running on the Android emulator now. |
@AidenMontgomery I should have some time today to test these on a few android devices. |
Remind me again why you wouldn't use fitToElelments and instead of having to specify an array of marker ids? |
Unless it has changed recently, fitToElements shows every marker on the map. In my use case I needed to zoom to the closest 2 markers on the map, relative to another marker. However, as soon as the user zooms out they need to be able to see all of the markers in the area. I could have done this by removing all other markers, then reacting to the region changed gesture and adding all of the other markers back on the map, but this felt simpler to me. |
Would love to be able to use this! |
@felipecsl I think your comments were addressed. Should we get this merged in? |
yep, looks good to me! |
* Added support for zooming the map to specific markers * Moved list creation outside of a loop in Android. Updated documentation for fitToSuppliedMarkers * Tidied up the fitToSuppliedMarkers example * Updated Android gif in the readme
This is a cleaned up version of an earlier pull request, which is based on a more recent fork of the master branch.