Google Maps Polyline - How do I remove it?

前端 未结 5 984
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-17 17:34

So I checked previous questions regarding this, which all relate to V2, which is of no help.

So, I create two markers, save them in an array as markers[\"to\"] and m

5条回答
  •  我在风中等你
    2021-01-17 18:02

    
    function traffic(map){
     // polyline
     this.path=null;
     this.map = google.maps.Map(ele, opt);
    }
    traffic.prototype._draw = function()
    {
        //create new polyline
        var path = new google.maps.Polyline({
            path: this.get('latlngArr'),
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 2
        });
        //delete old
        var prepath = this.path;
        if(prepath){
            prepath.setMap(null);
        }
        //new polyline
        path.setMap(this.map);
    
        this.path = path;
    }
    

提交回复
热议问题