Show little popup on click
This commit is contained in:
parent
15c1564832
commit
a41aec9609
1 changed files with 10 additions and 5 deletions
|
@ -102,6 +102,7 @@ OSM.Routing=function(map,name,jqSearch) {
|
||||||
html+="<table id='turnbyturn' />";
|
html+="<table id='turnbyturn' />";
|
||||||
$('#sidebar_content').html(html);
|
$('#sidebar_content').html(html);
|
||||||
// Add each row
|
// Add each row
|
||||||
|
var cumulative=0;
|
||||||
for (var i=0; i<steps.length; i++) {
|
for (var i=0; i<steps.length; i++) {
|
||||||
var step=steps[i];
|
var step=steps[i];
|
||||||
var instCodes=step[0].split('-');
|
var instCodes=step[0].split('-');
|
||||||
|
@ -122,13 +123,17 @@ OSM.Routing=function(map,name,jqSearch) {
|
||||||
row.append("<td class='direction i"+instCodes[0]+"'> ");
|
row.append("<td class='direction i"+instCodes[0]+"'> ");
|
||||||
row.append("<td class='instruction'>"+instText);
|
row.append("<td class='instruction'>"+instText);
|
||||||
row.append("<td class='distance'>"+dist);
|
row.append("<td class='distance'>"+dist);
|
||||||
with ({n: i}) { row.on('click',function(e) { r.clickTurn(n); });
|
with ({num: i, dist: step[3]}) {
|
||||||
}
|
row.on('click',function(e) {
|
||||||
|
r.clickTurn(num, r.polyline.getLatLngs()[dist]);
|
||||||
|
});
|
||||||
|
};
|
||||||
$('#turnbyturn').append(row);
|
$('#turnbyturn').append(row);
|
||||||
|
cumulative+=step[2];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
r.clickTurn=function(num) {
|
r.clickTurn=function(num,latlng) {
|
||||||
console.log("clicked turn",num);
|
L.popup().setLatLng(latlng).setContent("<p>"+(num+1)+"</p>").openOn(r.map);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue