hansemannn / titanium-googlemaps

🗺 Use the Google Maps SDK in Titanium
Other
87 stars 26 forks source link

Zoom to encompass pins / polygons / coordinates? #63

Closed bitfabrikken closed 7 years ago

bitfabrikken commented 7 years ago

Is there a way to set the zoom level to encompass some given coordinates and such?

I have it working in ti.map by calculating it manually, but it uses latitudeDelta and longitudeDelta, where as ti.googlemaps uses a zoom level I can quite figure out.

I know from the Google Maps Javascript SDK, that there's some functions to easily set the map to encompass all custom pins and such - maybe there's something like that here also?

Another way would be to use the fitBounds method which I see is in GMSCameraUpdate.h, but I can't quite figure out how to call it.

hansemannn commented 7 years ago

Yeah, actually https://github.com/hansemannn/ti.googlemaps/pull/58 will expose thr whole camera-update API with all the methods mentioned in this interface, including setTarget. After that, you can use the camera update as an argument in animateWithCameraUpdate or moveCamera to achieve smooth camera movements. The PR should be stable, but I didn't merge it because of some outstanding adjustments to the cluster (custom icons) so far. Feel free to try it!

bitfabrikken commented 7 years ago

Thank you @hansemannn, I will wait until it's part of master then. I'm not too good with git, so don't know how to pull down that pull request via command line :)