Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
740 views
in Technique[技术] by (71.8m points)

google maps api 3 - Close InfoWindow for local business marker

I have a new google map app using v3 of the API. On it I have a few custom markers with info windows. I use a global variable to ensure only one info window opens at any one time - everything is as it should be.

However the map comes with many local business markers, just like the ones all over this map (http://goo.gl/maps/M6m3), all of which open their own infowindows. If I click on one of these my infowindow doesn't get closed, and if I click on one of my markers, the built in infowindow also doesn't close - leaving multiple windows open.

Can this be resolved?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sounds like you want the "Points of Interest" (AKA POI) on the map to not be clickable (or to be able to capture the click on them).

This was tracked as an FR in the issue tracker and was recently implemented using a new property clickableIcons in MapOptions

If you set it to false, POI features will no longer be clickable. You can also use the get/setClickableIcons methods on the Map object to change this dynamically.

One other way to deal with them is to remove POIs from the map (using styled maps), if you don't want to have the infowindow open when they are clicked.

Here (How to remove certain places on a map ) is one discussion on the v3 API group about using styled maps to remove them.

And here (Disabling POI's InfoWindows - workaround found) is another.

At least now it doesn't cost more to do that (styled maps used to be more expensive than normal maps).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...