停用Google Maps JS API中POI标记的点击行为 [英] Disable click behavior of POI markers in Google Maps JS API

查看:113
本文介绍了停用Google Maps JS API中POI标记的点击行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Google Maps API v3.6开始,地图现在包含兴趣点,这些兴趣点是嵌入到地图中的灰色标记。当用户点击此图标时,InfoWindow将显示关于该业务(或公园,医院等)的信息。



可以通过设置样式关闭这些功能。 (请参阅样式数组示例)



https://code.google.com/apis/maps/documentation/javascript/styling.html



一旦他们关闭后,图标,名称和阴影区域(用于公园和医院)将消失。

在Google Maps API v3.6之前,没有任何图标;只有名称和区域。



问题:有没有办法删除这些兴趣点的点击图标打开信息窗口行为?我仍然想保留图标,名称和区域;只想删除点击行为。



备选问题:是否有方法可以下载/保存Google Maps API v3.5的JavaScript以存储在我的服务器上?目前,v3.5正在为我所需要的工作正常工作。在二月份,Google将不再提供v3.5的代码,而只会提供v3.6,v3.7,v3.8。



退出次要版本的Google Maps API v3,并使用API​​的冻结版本:

https://code.google.com/apis/maps/documentation/javascript/basics.html#Versioning



我试过并考虑过的事情:单击地图时添加事件侦听器不起作用,因为嵌入的标记会被点击而不是地图。添加clickable:false作为一个属性是在黑暗中拍摄的,没有结果。设置visiblility:off将其全部删除,使地图的内容更少。设置visibility:simplified会删除该位置的名称,尽管onclick行为仍然存在。把一个看不见的DIV叠加到地图上可能会奏效,虽然它会消除平移/缩放/拖动地图的能力而不会增加复杂性。



设置一个样式,使featureType: poi,elementType:标签,visibility:off将导致显示医院/墓地/公园的粉色/灰色/绿色区域,没有标记或名称。它将返回更多的颜色到地图。

解决方案

此问题已记录在谷歌:



http://code.google.com/p / gmaps-api-issues / issues / detail?id = 3866



请在这个问题上对您的需求进行明星和评论。


As of Google Maps API v3.6, maps now include "points of interest", which are gray markers embedded into a map. When the user clicks on this icon, an InfoWindow appears with information about that business (or park, hospital, etc.)

These can be turned off by setting the Styling. (See "Style Array Example")

https://code.google.com/apis/maps/documentation/javascript/styling.html

Once they are turned off, the icons, names, and shaded regions (for parks and hospitals) go away.

Before Google Maps API v3.6, there were no icons; only the names and regions.

The question: is there a way to remove the "click icon to open info window" behavior of these points of interest? I still want to keep the icons, names, and regions; only want to remove the click behavior.

Alternate question: is there a way to download/save the JavaScript of the v3.5 of Google Maps API to store on my server? At present, v3.5 is working fine for what I need. In February, Google will no longer provide v3.5 of the code and will instead provide only v3.6, v3.7, v3.8.

Retiring of minor versions of Google Maps API v3, and using the "frozen" version of an API:

https://code.google.com/apis/maps/documentation/javascript/basics.html#Versioning

Things I've tried and considered: Adding an event listener when the map is clicked does not work, because the embedded markers are clicked instead of the map. Adding "clickable: false" as a property was a shot in the dark, with no result. Setting "visiblility: off" removes it all, leaving the map with less content. Setting "visibility: simplified" removes the name of the location, though the onclick behavior is still present. Putting an invisible DIV overlaying the map might work, though it would remove the ability to pan/zoom/drag the map without increasing complexity.

Setting a style so that featureType: poi, elementType: labels, visibility: off will result in showing the pink/gray/green regions for hospitals/cemeteries/parks, without the marker or name. It returns more color to the map.

解决方案

This issue has been logged with google at:

http://code.google.com/p/gmaps-api-issues/issues/detail?id=3866

Please star and comment your needs on this issue there.

这篇关于停用Google Maps JS API中POI标记的点击行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆