refs #10 add lat/lng fields in popup to view/edit coordinates with precise values

merge-requests/1/head
Julien Veyssier 2017-01-20 11:03:24 -03:00
parent dd7708da77
commit 3b505e7b55
1 changed files with 9 additions and 0 deletions

View File

@ -446,6 +446,9 @@ function load_map() {
buttonParent.find('select[role=symbol]').val('unknown'); buttonParent.find('select[role=symbol]').val('unknown');
} }
buttonParent.find('select[role=symbol]').change(); buttonParent.find('select[role=symbol]').change();
var latlng = gpxedit.layersData[id].layer.getLatLng();
buttonParent.find('input.layerLat').val(latlng.lat);
buttonParent.find('input.layerLon').val(latlng.lng);
} }
}); });
@ -475,6 +478,8 @@ function onCreated(type, layer){
'<tr><td>'+t('gpxedit', 'Description')+'</td><td><textarea class="layerDesc"></textarea></td></tr>'+ '<tr><td>'+t('gpxedit', 'Description')+'</td><td><textarea class="layerDesc"></textarea></td></tr>'+
'<tr><td>'+t('gpxedit', 'Comment')+'</td><td><textarea class="layerCmt"></textarea></td></tr>'; '<tr><td>'+t('gpxedit', 'Comment')+'</td><td><textarea class="layerCmt"></textarea></td></tr>';
if (type === 'marker') { if (type === 'marker') {
popupTxt = popupTxt + '<tr><td>'+t('gpxedit', 'Lat')+'</td><td><input class="layerLat"></input></td></tr>';
popupTxt = popupTxt + '<tr><td>'+t('gpxedit', 'Lon')+'</td><td><input class="layerLon"></input></td></tr>';
popupTxt = popupTxt + '<tr><td>'+t('gpxedit', 'Symbol')+'</td><td><select role="symbol">'; popupTxt = popupTxt + '<tr><td>'+t('gpxedit', 'Symbol')+'</td><td><select role="symbol">';
popupTxt = popupTxt + '<option value="">'+t('gpxedit', 'No symbol')+'</option>'; popupTxt = popupTxt + '<option value="">'+t('gpxedit', 'No symbol')+'</option>';
popupTxt = popupTxt + '<option value="unknown">'+t('gpxedit', 'Unknown symbol')+'</option>'; popupTxt = popupTxt + '<option value="unknown">'+t('gpxedit', 'Unknown symbol')+'</option>';
@ -1176,6 +1181,10 @@ $(document).ready(function(){
var theicon = symbolIcons[wst]; var theicon = symbolIcons[wst];
gpxedit.layersData[id].layer.setIcon(theicon); gpxedit.layersData[id].layer.setIcon(theicon);
} }
var lat = $(this).parent().find('.layerLat').val();
var lon = $(this).parent().find('.layerLon').val();
var latlng = L.latLng(lat, lon);
gpxedit.layersData[id].layer.setLatLng(latlng);
} }
if (name !== ''){ if (name !== ''){
if (tst === 'p'){ if (tst === 'p'){