重叠多边形区域中的Cant GetPosition [英] Cant GetPosition in Overlay Polygon Zone

查看:72
本文介绍了重叠多边形区域中的Cant GetPosition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

im在用户单击时获取地图上的当前位置(纬度和经度),并且脚本运行良好,它为我提供了我在地图中单击的位置的位置,问题是当我单击彩色的多边形区域.

im getting the current position (latitude and Longitude) on the map when a user click on it, and works fine the script, it gives me the position of the place i clicked in the map, the problem is that doesnt work when i click in the colored polygon zones.

我已经尝试找出解决方法,但无法找出解决方法.

I already try to figure out how to solve it, but but cant figure out the solution.

我在这里留下上面的链接:http://jsbin.com/nirikuwofo/edit?html,输出

I leave here the link above: http://jsbin.com/nirikuwofo/edit?html,output

推荐答案

您只需要向所有多边形添加 clickable:false .这样,单击将穿过多边形并单击下面的地图.例如:

You just need to add clickable: false to all the polygons. That way the click will go trough the polygon and will click the map underneath. E.g.:

var zone1 = new google.maps.Polygon({
    paths: zone1_Coords,
    strokeColor: '#d9dc02',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: '#f5f801',
    fillOpacity: 0.35
    ,clickable:false // <-- ADD THIS LINE
  });

http://jsbin.com/sokugoziso/1/edit?html,输出

这篇关于重叠多边形区域中的Cant GetPosition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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