diff --git a/resources/assets/js/newnote.js b/resources/assets/js/newnote.js index 1aaa8b38..0d6aa404 100644 --- a/resources/assets/js/newnote.js +++ b/resources/assets/js/newnote.js @@ -71,24 +71,34 @@ function addMap(latitude, longitude, places) { //when the location marker is dragged, if the new place form elements exist //update the lat/lng values marker.on('dragend', function () { + var mapMarkerLatitude = getLatitudeFromMapboxMarker(marker.getLatLng()); + var mapMarkerLongitude = getLongitudeFromMapboxMarker(marker.getLatLng()); + var coordsOption = document.querySelector('#option-coords'); + if (coordsOption != null) { + coordsOption.value = 'geo:' + mapMarkerLatitude + ',' + mapMarkerLongitude; + } var placeFormLatitude = document.querySelector('#place-latitude'); if (placeFormLatitude !== null) { - placeFormLatitude.value = getLatitudeFromMapboxMarker(marker.getLatLng()); + placeFormLatitude.value = mapMarkerLatitude; } var placeFormLongitude = document.querySelector('#place-longitude'); if (placeFormLongitude !== null) { - placeFormLongitude.value = getLongitudeFromMapboxMarker(marker.getLatLng()); + placeFormLongitude.value = mapMarkerLongitude; } }); //create the