popup style, set tooltips on load

merge-requests/1/head
Julien Veyssier 2016-12-02 14:53:26 +01:00
parent 867a494bfb
commit 1f060deb30
2 changed files with 12 additions and 6 deletions

View File

@ -491,10 +491,13 @@ input[type=checkbox]
font-weight: bold !important; font-weight: bold !important;
} }
h2#loadtitle, h2#savetitle{ h2#loadtitle, h2#savetitle{
text-align:center; text-align: center;
cursor: pointer; cursor: pointer;
} }
#clearButton{ h2.popupTitle{
text-align: center;
}
#clearButton, .popupOkButton{
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
display:block; display:block;

View File

@ -246,14 +246,15 @@ function load_map() {
// it generates the popup content and initializes the layer's data // it generates the popup content and initializes the layer's data
// it returns the layer in case we want to set the layer's data manually (when loading a gpx) // it returns the layer in case we want to set the layer's data manually (when loading a gpx)
function onCreated(type, layer){ function onCreated(type, layer){
var popupTitle = 'Line'; var popupTitle = 'Track';
if (type === 'marker') { if (type === 'marker') {
popupTitle = 'Waypoint'; popupTitle = 'Waypoint';
} }
layer.bindPopup('<h2>'+popupTitle+'</h2>Name : <input class="layerName"></input><br/>'+ layer.bindPopup('<h2 class="popupTitle">'+popupTitle+'</h2><table class="popupdatatable">'+
'Description : <textarea class="layerDesc"></textarea><br/>'+ '<tr><td>Name</td><td><input class="layerName"></input></td></tr>'+
'Comment : <textarea class="layerCmt"></textarea><br/>'+ '<tr><td>Description</td><td><textarea class="layerDesc"></textarea></td></tr>'+
'<tr><td>Comment</td><td><textarea class="layerCmt"></textarea></td></tr></table>'+
'<button class="popupOkButton" layerid="'+gpxedit.id+'">OK</button>'); '<button class="popupOkButton" layerid="'+gpxedit.id+'">OK</button>');
layer.gpxedit_id = gpxedit.id; layer.gpxedit_id = gpxedit.id;
@ -352,6 +353,7 @@ function drawMarker(latlng, name, desc, cmt){
}) })
}); });
var layer = onCreated('marker', m); var layer = onCreated('marker', m);
m.bindTooltip(name, {sticky:true});
gpxedit.layersData[layer.gpxedit_id].name = name; gpxedit.layersData[layer.gpxedit_id].name = name;
gpxedit.layersData[layer.gpxedit_id].comment = cmt; gpxedit.layersData[layer.gpxedit_id].comment = cmt;
gpxedit.layersData[layer.gpxedit_id].description = desc; gpxedit.layersData[layer.gpxedit_id].description = desc;
@ -364,6 +366,7 @@ function drawLine(latlngs, name, desc, cmt){
weight: 7 weight: 7
}); });
var layer = onCreated('polyline', p); var layer = onCreated('polyline', p);
p.bindTooltip(name, {sticky:true});
gpxedit.layersData[layer.gpxedit_id].name = name; gpxedit.layersData[layer.gpxedit_id].name = name;
gpxedit.layersData[layer.gpxedit_id].comment = cmt; gpxedit.layersData[layer.gpxedit_id].comment = cmt;
gpxedit.layersData[layer.gpxedit_id].description = desc; gpxedit.layersData[layer.gpxedit_id].description = desc;