From 3973fb3e2037ee476a76a21fb830f248dd2e8a70 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 7 Oct 2016 15:22:21 +0100 Subject: [PATCH] Allow cordinated to be sent as a geo: URI --- resources/assets/js/newnote.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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