Instead of adding and removing the polyline, just update all of the
properties:
if(!polyline)
polyline = new google.maps.Polyline({map: _map});
polyline.setOptions({path:_path,strokeColor:"#660099",strokeWeight:
3});
polyline.setPath(_path);
Chad Killingsworth
On Oct 26, 3:15 am, mrt <[email protected]> wrote:
> Hi all
>
> I am porting this linedrawing thing where a user can draw a route on
> the map from v2 to v3.
>
> In Maps v2 i would use:
>
> _map.removeOverlay( polyline );
> polyline = new GPolyline(_path, "#660099", line_thickness, 1,
> {clickable:false});
> _map.addOverlay( polyline );
>
> In Maps v3 the addOverlay and removeOverlay apparently have been
> removed, and I guess you would do something like:
>
> if ( polyline ) polyline.setMap(null);
> polyline = new
> google.maps.Polyline( {path:_path,strokeColor:"#660099",strokeWeight:
> 3, map:_map} );
>
> But calling setMap(null) results in a flickering in the rendering
> sometimes.
>
> Now my question is;
>
> If you leave out "if ( polyline ) polyline.setMap(null);" you don't
> get the flickering, but I would think the polyline objects are
> stacked, doubling the amount of vertices the map has to calculate
> every time the line is "updated"?
>
> Is this assumption true? How do you avoid the flickering when
> "updating" a polyline?
>
> Regards
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.