Is it possible to make a Polygon clickable using the Bing Maps API?

房东的猫 提交于 2019-12-24 19:07:55

问题


I can put a pushpin in the center of each Polygon to achieve a "clickable" region but that is an extra step I'd rather not take.


回答1:


Yes, but it's kind of a pain. The steps are:

1.) attach to the mousclick event within VEMap 2.) determine if the mouseclick was within the area of your polygon or on a shape 3.) stop event propogation to the map object itself

The mousehandler portion here: http://www.codeproject.com/KB/scripting/Use_of_VEMap.aspx#heading0012 is a decent primer, though if you need specific code I can work that up for you as well.

As a note, you stop the bubbling of the event by returning true within your own funciton: http://msdn.microsoft.com/en-us/library/bb412543.aspx



来源:https://stackoverflow.com/questions/2375697/is-it-possible-to-make-a-polygon-clickable-using-the-bing-maps-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!