diff options
author | Christopher Baines <cb15g11@soton.ac.uk> | 2014-09-10 21:08:36 +0100 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2014-09-10 21:08:36 +0100 |
commit | 25046fb610d1198c8c1fbc511e6538c4af48ba42 (patch) | |
tree | ad57c7ddaa3b34394e7885938a0886389394cacd /examples | |
parent | 47f0d35c5d1e7b210fce4928d62cdfe0ae5b5961 (diff) | |
download | leaflet-soton-25046fb610d1198c8c1fbc511e6538c4af48ba42.tar leaflet-soton-25046fb610d1198c8c1fbc511e6538c4af48ba42.tar.gz |
Improve portal/door handling
Diffstat (limited to 'examples')
-rw-r--r-- | examples/doors.html | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/examples/doors.html b/examples/doors.html index 3c29b11..4957a41 100644 --- a/examples/doors.html +++ b/examples/doors.html @@ -114,6 +114,7 @@ } var entrance = entrances[entrance_id]; + console.log(entrance); if ("geometry" in entrance) { return L.GeoJSON.coordsToLatLng(entrance.geometry.coordinates); } else { @@ -194,30 +195,28 @@ } addToTable(comment); - var a = document.createElement("a"); - a.textContent = "Show"; - a.href = "#"; - - // when the entrance is clicked - a.onclick = function() { - var coordinates = entranceLocations[index]; - - if (coordinates === null) { - return; - } - - // pan to the entrance - map.panTo(coordinates); - - if ("level" in entrance.properties) { - // display the relevant level - map.setLevel(entrance.properties.level); - } - - return false; - }; - - addToTable(a); + var coordinates = entranceLocations[index]; + if (coordinates === null) { + addToTable(document.createTextNode("No Location")); + } else { + var a = document.createElement("a"); + a.textContent = "Show"; + a.href = "#"; + + // when the entrance is clicked + a.onclick = function() { + // pan to the entrance + map.panTo(coordinates); + + if ("level" in entrance.properties) { + // display the relevant level + map.setLevel(entrance.properties.level); + } + + return false; + }; + addToTable(a); + } tbody.appendChild(tr); }); |