Below I have a google map containing a polygon with a hole in it.
I have the following event listeners:
google.maps.event.addListener(myPolygon.getPath(), 'insert_at', getPolygonCoords(myPolygon))
google.maps.event.addListener(myPolygon.getPath(), 'set_at', getPolygonCoords(myPolygon))
For some reason when I move any of the innerCoords
, none of the events fire.
How can I access an event that fires when the innerCoords are moved?
const getPolygonCoords = (myPolygon) => () => {
var len = myPolygon.getPath().getLength()
let points = []
for (var i = 0; i < len; i++) {
let point = myPolygon.getPath().getAt(i).toUrlValue(5).split(',')
let lat = parseFloat(point[0])
let lng = parseFloat(point[1])
points.push({lat, lng})
}
console.log(JSON.stringify(points))
this.props.onChange(points)
}