This is certainly possible, but I would not recommend it, for the simple
reason that many thousands of points could be generated in this way in just
a couple of seconds.
You could use something like this (not tested) :
var aPolyPts = []; // Global
var userDrawnPoly = new google.maps.Polyline(); // Global
google.maps.event.addListener(map, "mousemove", function(event) {
var pos = event.latLng;
//var lat = pos.lat();
//var lng = pos.lng();
aPolyPts.push(pos);
userDrawnPoly.setPath(aPolyPts);
userDrawnPoly.setMap(map);
});
Ideally, you would want to slow down the rate at which points are added to
the polygon, either by placing a setTimeout() in the listener code or,
better, not to use mousemove listener at all, but rather a click or
rightclick listener so that points are only added to the polyline when the
user clicks (or right-clicks) on the map.
HTH,
Rob
On Sunday, 24 December 2017 08:10:52 UTC+1, [email protected] wrote:
>
> I want my users to draw polygons on google maps but I want dynamic
> polygons with hovering the moused
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.