How can I move the markers together? I use the bindTo, but it put them the same position. But I need to keep the distance between them.
marker1.bindTo('position', marker2, 'position');
Any help would be appreciated.
The result:
google.maps.event.addListener(editMarkers[0], 'dragstart', function() {
latDiff = editMarkers[0].getPosition().lat()-editMarkers[1].getPosition().lat();
lngDiff = editMarkers[0].getPosition().lng()-editMarkers[1].getPosition().lng();
});
google.maps.event.addListener(editMarkers[0], 'drag', function() {
editMarkers[1].setPosition(new google.maps.LatLng(editMarkers[0].getPosition().lat()-latDiff,editMarkers[0].getPosition().lng()-lngDiff));
});
I would save them all in an array. Make an event for when you move one and also move the others with it (modify their coordinates).