Skip to content

Instantly share code, notes, and snippets.

@getsudocode
Created July 18, 2018 08:01
Show Gist options
  • Save getsudocode/af4842688fb6665d089a9cb56cc3878e to your computer and use it in GitHub Desktop.
Save getsudocode/af4842688fb6665d089a9cb56cc3878e to your computer and use it in GitHub Desktop.
function addMarker(latLng) {
let marker = new google.maps.Marker({
map: map,
position: latLng,
draggable: true
});
// add listener to redraw the polyline when markers position change
marker.addListener('position_changed', function() {
drawPolyline();
});
//store the marker object drawn in global array
markersArray.push(marker);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment