【问题标题】:Google Maps polygon comprised of circles由圆圈组成的谷歌地图多边形
【发布时间】:2021-09-19 21:23:15
【问题描述】:

我有一个奇怪的错误,我绘制的所有多边形都是由圆圈组成的。当我放大或缩小时,圆的直径和数量会发生变化。还有其他人有这个问题吗?谷歌地图 V3,JS。尝试过 Chrome 和 Firesfox - 同样的事情。

//draw polygon
    geoFenceGeometry = new google.maps.Polygon({
        paths: geoFencePoints,
        strokeColor: "#FF0000",
        strokeOpacity: 1,
        strokeWeight: 4,
        editable:true,
        draggable:true,
        geodesic:true,
        fillColor: "#000000",
        fillOpacity: 0.2,
    });
    geoFenceGeometry.addListener("mouseup", () => {
        
        geoFencePoints = geoFenceGeometry.getPath();
        if(geoFencePoints.length >= geoFencePointsMaxLen) geoFenceGeometry.setOptions({editable:false});
        redrawPolygonMarkers();
        
    });
    geoFenceGeometry.setMap(map);

【问题讨论】:

    标签: google-maps google-maps-api-3 maps


    【解决方案1】:

    显然这是由于与网站上其他样式的干扰造成的。此错误已通过添加以下 CSS 到地图画布样式修复:

    #map {
        box-sizing: content-box;
        border-radius:0;
    }
    #map * {
        box-sizing: content-box;
        border-radius:0; 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-03
      • 2012-06-15
      相关资源
      最近更新 更多