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

Autocomplete search box not limiting results to within map bounds #6

Open
metastew opened this issue Feb 17, 2017 · 1 comment
Open

Comments

@metastew
Copy link

I came across an issue in the Autocomplete portion of the course. I was running my autocomplete code to display pizza restaurants and noticed that when I typed in 'pizza', it would zoom the map all the way out to show North America continent and show international listings instead of inside NYC area. It worked fine if I typed in 'pizza NYC' though. At first I thought I had made a mistake in my code, so I copied over the code sample from github repo. Same thing happened again with the code from github.

It's my understanding that in the code, when you call searchBox.setBounds(map.getBounds()) in the code, it would display searchBox results to be within NYC area, not internationally.

@blastZ
Copy link

blastZ commented Jul 5, 2017

the right way is
google.maps.event.addListener(map, 'bounds_changed', function() { searchBox.setBounds(map.getBounds()); });

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