refs #6 symbol choice in popup only for markers
parent
b051fe1e40
commit
a7f8d16242
|
@ -363,13 +363,16 @@ function load_map() {
|
||||||
// this is needed because popup content is created each time we open one
|
// this is needed because popup content is created each time we open one
|
||||||
// so, the content is lost when it's closed
|
// so, the content is lost when it's closed
|
||||||
gpxedit.map.on('popupopen', function(e){
|
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();
|
var buttonParent = $('button.popupOkButton[layerid='+id+']').parent();
|
||||||
buttonParent.find('input.layerName').val(gpxedit.layersData[id].name);
|
buttonParent.find('input.layerName').val(gpxedit.layersData[id].name);
|
||||||
buttonParent.find('textarea.layerDesc').val(gpxedit.layersData[id].description);
|
buttonParent.find('textarea.layerDesc').val(gpxedit.layersData[id].description);
|
||||||
buttonParent.find('textarea.layerCmt').val(gpxedit.layersData[id].comment);
|
buttonParent.find('textarea.layerCmt').val(gpxedit.layersData[id].comment);
|
||||||
buttonParent.find('select[role=symbol]').val(gpxedit.layersData[id].symbol);
|
if (gpxedit.layersData[id].layer.type === 'marker'){
|
||||||
buttonParent.find('select[role=symbol]').change();
|
buttonParent.find('select[role=symbol]').val(gpxedit.layersData[id].symbol);
|
||||||
|
buttonParent.find('select[role=symbol]').change();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -387,14 +390,17 @@ function onCreated(type, layer){
|
||||||
'<tr><td>Name</td><td><input class="layerName"></input></td></tr>'+
|
'<tr><td>Name</td><td><input class="layerName"></input></td></tr>'+
|
||||||
'<tr><td>Description</td><td><textarea class="layerDesc"></textarea></td></tr>'+
|
'<tr><td>Description</td><td><textarea class="layerDesc"></textarea></td></tr>'+
|
||||||
'<tr><td>Comment</td><td><textarea class="layerCmt"></textarea></td></tr>';
|
'<tr><td>Comment</td><td><textarea class="layerCmt"></textarea></td></tr>';
|
||||||
popupTxt = popupTxt + '<tr><td>Symbol</td><td><select role="symbol">';
|
if (type === 'marker') {
|
||||||
popupTxt = popupTxt + '<option value="">No symbol</option>';
|
popupTxt = popupTxt + '<tr><td>Symbol</td><td><select role="symbol">';
|
||||||
for (var cl in symbolIcons){
|
popupTxt = popupTxt + '<option value="">No symbol</option>';
|
||||||
if (cl !== 'marker'){
|
for (var cl in symbolIcons){
|
||||||
popupTxt = popupTxt + '<option value="'+cl+'">'+cl+'</option>';
|
if (cl !== 'marker'){
|
||||||
|
popupTxt = popupTxt + '<option value="'+cl+'">'+cl+'</option>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
popupTxt = popupTxt + '</select></td></tr>';
|
||||||
}
|
}
|
||||||
popupTxt = popupTxt + '</select></td></tr></table>';
|
popupTxt = popupTxt + '</table>';
|
||||||
popupTxt = popupTxt + '<button class="popupOkButton" layerid="'+gpxedit.id+'">OK</button>';
|
popupTxt = popupTxt + '<button class="popupOkButton" layerid="'+gpxedit.id+'">OK</button>';
|
||||||
|
|
||||||
layer.bindPopup(popupTxt);
|
layer.bindPopup(popupTxt);
|
||||||
|
@ -898,13 +904,14 @@ $(document).ready(function(){
|
||||||
var wst = $('#markerstyleselect').val();
|
var wst = $('#markerstyleselect').val();
|
||||||
var tst = $('#tooltipstyleselect').val();
|
var tst = $('#tooltipstyleselect').val();
|
||||||
var symboo = $('#symboloverwrite').is(':checked');
|
var symboo = $('#symboloverwrite').is(':checked');
|
||||||
|
var type = gpxedit.layersData[id].layer.type;
|
||||||
|
|
||||||
gpxedit.layersData[id].name = name;
|
gpxedit.layersData[id].name = name;
|
||||||
gpxedit.layersData[id].description = description;
|
gpxedit.layersData[id].description = description;
|
||||||
gpxedit.layersData[id].comment = comment;
|
gpxedit.layersData[id].comment = comment;
|
||||||
gpxedit.layersData[id].symbol = symbol;
|
gpxedit.layersData[id].symbol = symbol;
|
||||||
gpxedit.layersData[id].layer.unbindTooltip();
|
gpxedit.layersData[id].layer.unbindTooltip();
|
||||||
if (gpxedit.layersData[id].layer.type === 'marker'){
|
if (type === 'marker'){
|
||||||
if (symboo && symbol !== '' && symbolIcons.hasOwnProperty(symbol)){
|
if (symboo && symbol !== '' && symbolIcons.hasOwnProperty(symbol)){
|
||||||
gpxedit.layersData[id].layer.setIcon(symbolIcons[symbol])
|
gpxedit.layersData[id].layer.setIcon(symbolIcons[symbol])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue