Skip to content
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

zooming on ios? #16

Closed
tfsmag opened this issue Mar 16, 2016 · 4 comments
Closed

zooming on ios? #16

tfsmag opened this issue Mar 16, 2016 · 4 comments

Comments

@tfsmag
Copy link

tfsmag commented Mar 16, 2016

Great job on this plugin. I am having trouble figuring out how to zoom in ios?

I can get the map and markers to come up in the emulator and on my devices, just can't seem to figure out how to get the map to zoom in on a certain spot. I've tried gMap.animatetozoom(n) and a couple of other things but can't seem to figure out the syntax. Is there a sample somewhere I haven't found for this? Any help would be greatly appreciated.

@dapriett
Copy link
Owner

You can update the zoom by binding it in the xml view

<maps:mapView latitude="{{ latitude }}" longitude="{{ longitude }}" 
                                    zoom="{{ zoom }}" bearing="{{ bearing }}" 
                                    tilt="{{ tilt }}" mapReady="OnMapReady"  
                                markerSelect="onMarkerSelect" 
                                cameraChanged="onCameraChanged" />

Could also just do mapView.zoom = n in javascript

@tfsmag
Copy link
Author

tfsmag commented Mar 17, 2016

hmmm, still doesn't seem to be working for me. I'm sure I'm missing something simple here. I tried putting this in my main-page.js

I set it right after declaring the mapview variable and the map just sits there fully zoomed out.

function onMapReady(args) {
console.log("onMapReady");
var mapView = args.object;
mapView.zoom = 10;

console.log(args.object);
console.log("Setting a marker...");

var marker = new mapsModule.Marker();
marker.position = mapsModule.Position.positionFromLatLng(-33.86, 151.20);
marker.title = "Sydney";
marker.snippet = "Australia";
marker.userData = { index : 1};
mapView.addMarker(marker);

marker = new mapsModule.Marker();
marker.position = mapsModule.Position.positionFromLatLng(-33.42, 151.32);
marker.title = "Gosford";
marker.snippet = "Australia";
var icon = new Image();
icon.imageSource = imageSource.fromResource('icon');
marker.icon = icon;
// marker.icon = 'icon';
marker.alpha = 0.8;
marker.flat = true;
marker.draggable = true;
marker.visible = false;
marker.userData = { index : 2};
mapView.addMarker(marker);

}

I'll keep goofing around with it, can't seem to find any clues in the logging in my terminal window.

@dapriett
Copy link
Owner

I added an example of zooming in the demo app

https://github.com/dapriett/nativescript-google-maps-sdk/blob/master/demo/app/main-page.js#L57

@tfsmag
Copy link
Author

tfsmag commented Mar 17, 2016

that worked! thank you very much.

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

No branches or pull requests

2 participants