When autocompleting, it would be useful to bias the selection of addresses according to the current viewport:
if ($("#edit-from").is("input.form-text")) {
var input_from = document.getElementById('edit-from');
var ac_from = new google.maps.places.Autocomplete(input_from);
ac_from.bindTo('bounds', map);
google.maps.event.addListener(ac_from, 'place_changed', function() {
var place_from = ac_from.getPlace();
$("#edit-from").val(place_from.formatted_address);
showAddress();
});
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | getdirections-autocomplete-bias-1670814.patch | 1.08 KB | munawar |
Comments
Comment #1
munawar commentedhutch:
Thanks for changing the code so quickly on my other post re. public transport.
You beat me to it by a few minutes. I'll upload a relevant patch to this thread anyway.
Munawar
Comment #2
hutch commentedI've just given this patch a quick test, works a treat, I will be adding this next week, making it an option that can be set to Always on, Never on or on/off checkbox on the form. That should keep everyone happy.
Google are certainly keeping the features flying in, it does show that a bit of competition keeps the corporates on their toes ;-)
Comment #3
hutch commentedAdded viewport bias feature to dev, along with transit layer.