2

Is it possible to mark (change color/size etc) vertex in editable Polygon?

var polygon = new google.maps.Polygon({
            map:_map,
            path:path,
            editable:true,
            draggable:true,
            fillColor: '#428FDE',
            fillOpacity:0.4,
            strokeColor:'#428FDE',
            strokeWeight:1
        });

enter image description here

For example when i hover divs (1,2,3 or 4) i want to mark vertex in polygon.

I can add just custom marker in vertex LatLng, but i hope its some simply solution.

duncan
  • 31,401
  • 13
  • 78
  • 99
Skodsgn
  • 940
  • 1
  • 10
  • 33
  • What you said - I don't think there's a simple solution, I think you need to add your own marker on that vertex's LatLng – duncan Nov 10 '15 at 13:26
  • related question: [Google Maps V3 Polyline : make it editable without center point(s)](http://stackoverflow.com/questions/32255224/google-maps-v3-polyline-make-it-editable-without-center-points) – geocodezip Nov 10 '15 at 14:01

1 Answers1

0

There doesn't seem to be any way to adjust the styling of the vertices, they seem to inherit whatever their Polyline's styling is.

What you could do is add a marker on that point. Something like:

var path = polyline.getPath();
var point;

$('div').on('hover', function() {
    var vertex = $(this).data('vertex');

    point = new google.maps.Marker({
        position: path[vertex-1]
        map: map
    });
});

<div data-vertex="1">1</div>
<div data-vertex="2">2</div>
<div data-vertex="3">3</div>
<div data-vertex="4">4</div>
duncan
  • 31,401
  • 13
  • 78
  • 99