diff --git a/js/gpxedit.js b/js/gpxedit.js index d6a0083..773cc1a 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -363,13 +363,16 @@ function load_map() { // this is needed because popup content is created each time we open one // so, the content is lost when it's closed gpxedit.map.on('popupopen', function(e){ - var id = parseInt(e.popup.getContent().match(/layerid="(\d+)"/)[1]); + var id = e.popup._source.gpxedit_id; + //var id = parseInt(e.popup.getContent().match(/layerid="(\d+)"/)[1]); var buttonParent = $('button.popupOkButton[layerid='+id+']').parent(); buttonParent.find('input.layerName').val(gpxedit.layersData[id].name); buttonParent.find('textarea.layerDesc').val(gpxedit.layersData[id].description); buttonParent.find('textarea.layerCmt').val(gpxedit.layersData[id].comment); - buttonParent.find('select[role=symbol]').val(gpxedit.layersData[id].symbol); - buttonParent.find('select[role=symbol]').change(); + if (gpxedit.layersData[id].layer.type === 'marker'){ + buttonParent.find('select[role=symbol]').val(gpxedit.layersData[id].symbol); + buttonParent.find('select[role=symbol]').change(); + } }); } @@ -387,14 +390,17 @@ function onCreated(type, layer){ 'Name'+ 'Description'+ 'Comment'; - popupTxt = popupTxt + 'Symbol'; + popupTxt = popupTxt + ''; + for (var cl in symbolIcons){ + if (cl !== 'marker'){ + popupTxt = popupTxt + ''; + } } + popupTxt = popupTxt + ''; } - popupTxt = popupTxt + ''; + popupTxt = popupTxt + ''; popupTxt = popupTxt + ''; layer.bindPopup(popupTxt); @@ -898,13 +904,14 @@ $(document).ready(function(){ var wst = $('#markerstyleselect').val(); var tst = $('#tooltipstyleselect').val(); var symboo = $('#symboloverwrite').is(':checked'); + var type = gpxedit.layersData[id].layer.type; gpxedit.layersData[id].name = name; gpxedit.layersData[id].description = description; gpxedit.layersData[id].comment = comment; gpxedit.layersData[id].symbol = symbol; gpxedit.layersData[id].layer.unbindTooltip(); - if (gpxedit.layersData[id].layer.type === 'marker'){ + if (type === 'marker'){ if (symboo && symbol !== '' && symbolIcons.hasOwnProperty(symbol)){ gpxedit.layersData[id].layer.setIcon(symbolIcons[symbol]) }