这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@markrickert
Copy link
Member

Nice for zooming into all annotations PLUS the user to fit the screen.

This should always be called after you know you have a user location on the screen, most likely inside the on_user_location(location) method. Otherwise, it ignores the user's location since it's still nil.

@markrickert
Copy link
Member Author

@jamonholmgren if you want to take a look and merge, i'll release a new gem version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to like option hashes (you've probably noticed) since they self-document on the app side.

zoom_to_fit_annotations(true, true)
# vs
zoom_to_fit_annotations(true, include_user: true)
# or even better (but this breaks the API):
zoom_to_fit_annotations(animated: true, include_user: true)

@jamonholmgren
Copy link
Member

Otherwise looks good! Any way to test this? I know map tests are a royal pain.

@markrickert
Copy link
Member Author

Updated to take a hash as requested... also preserves backwards compatibility so that if a user passes zoom_to_fit_annotations(true) it converts the args into {animated:true, include_user: false}

@markrickert
Copy link
Member Author

Tests are a PITA, and I'm not sure there's any way to test easily. I've done integration tests on all possible parameter combinations and it works as expected.

jamonholmgren added a commit that referenced this pull request Nov 17, 2014
Adds the ability to include the user pin in the zoom_to_fit_annotations method
@jamonholmgren jamonholmgren merged commit 35f58ef into master Nov 17, 2014
@jamonholmgren jamonholmgren deleted the zoom_include_user branch November 17, 2014 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants