Closed luca3m closed 10 years ago
ping.
I need this functionally.
Thanks
You don't need this, you can do it with current code. You can set map zoom on addresspicker options like this:
var addresspickerMap = $( "#addresspicker_map" ).addresspicker({
mapOptions: {
zoom: 4,
center: new google.maps.LatLng(46, 2),
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
});
And you can listen for any map changes like this:
// Update zoom field
var map = $("#addresspicker_map").addresspicker("map");
google.maps.event.addListener(map, 'idle', function(){
$('#zoom').val(map.getZoom());
});
I just updated the demo with this code.
Regarding the rails comment, it's out of the scope of the plugin and you cannot force people to use jquery like this instead of using a CDN for example.
Thanks,
But then not is zoom updated when click to zoom buttons.
If is done like do @luca3m , then you can do it:
var gmap = addresspickerMap.addresspicker( "map");
google.maps.event.addListener(gmap, 'zoom_changed', function() {
addresspickerMap.addresspicker("updatePosition");
});
And every time that change zoom, zoom value is updated.
Sorry, I don't understand what you say
Sorry,
Your solution only update zoom after search location in autocomplete, not every time that zoom is changed using zoom button in map.
Yes it does I updated the online demo http://xilinus.com/jquery-addresspicker/demos/index.html with the latest commit. Zoom is displayed below Lat/Lng
Ok, now works.
Thanks.
Hi,
I've added the option to save the zoom of the map, it's useful for saving it and later redisplay the map with the same condition. Also I added "//= require" directives so the script works nice with Rails Assets Pipeline.
I hope it will be useful and thanks for your work :)
Regards