update sockjs library

This commit is contained in:
Dave Conway-Jones 2019-03-16 20:02:05 +00:00
parent e069471aa8
commit 4a6c05b24f
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
10 changed files with 181 additions and 35 deletions

View File

@ -69,7 +69,7 @@
<link rel="stylesheet" type="text/css" href="leaflet/dialog-polyfill.css"/> <link rel="stylesheet" type="text/css" href="leaflet/dialog-polyfill.css"/>
</head> </head>
<body onunload="ws.send(JSON.stringify({'action':'end'})); ws.disconnect;"> <body onunload="ws.send(JSON.stringify({'action':'end'})); ws.close();">
<div id="topbar"> <div id="topbar">
<a href="https://nodered.org"><img src="images/node-red.png" width="60px" height="24px"/></a> <a href="https://nodered.org"><img src="images/node-red.png" width="60px" height="24px"/></a>
<span class="topbar"> Node-RED - map all the things</span> <span class="topbar"> Node-RED - map all the things</span>
@ -89,7 +89,6 @@
</table></div> </table></div>
<div id="map"></div> <div id="map"></div>
<div id="foot"></div> <div id="foot"></div>
<!-- <div id="heat"><button type="button" onclick="clearHeat();">Clear Heatmap</button></div> -->
<dialog id="helpWindow"> <dialog id="helpWindow">
<h3>Node-RED - Map all the things</h3> <h3>Node-RED - Map all the things</h3>
@ -212,10 +211,10 @@ var onoffline = function() {
if (!navigator.onLine) { map.addLayer(layers["_countries"]); } if (!navigator.onLine) { map.addLayer(layers["_countries"]); }
} }
// Set Ctl-Alt-3 to switch to 3d view
document.addEventListener ("keydown", function (ev) { document.addEventListener ("keydown", function (ev) {
if (ev.ctrlKey && ev.altKey && ev.code === "Digit3") { if (ev.ctrlKey && ev.altKey && ev.code === "Digit3") {
ws.close(); ws.close();
//window.onbeforeunload = null;
window.location.href = "index3d.html"; window.location.href = "index3d.html";
} }
}); });
@ -278,15 +277,10 @@ else {
if (!inIframe) { if (!inIframe) {
// Add the fullscreen button // Add the fullscreen button
L.control.fullscreen().addTo(map); L.control.fullscreen().addTo(map);
// map.on('fullscreenchange', function () {
// if (map.isFullscreen()) { console.log('entered fullscreen') }
// else { console.log('exited fullscreen'); }
// });
// Add the locate my position button // Add the locate my position button
L.easyButton( 'fa-crosshairs fa-lg', function() { L.easyButton( 'fa-crosshairs fa-lg', function() {
map.locate({setView:true, maxZoom:16}); map.locate({setView:true, maxZoom:16});
}, "Locate me").addTo(map); }, "Locate me").addTo(map);
// Add the measure/ruler button // Add the measure/ruler button
L.Control.measureControl().addTo(map); L.Control.measureControl().addTo(map);
@ -299,7 +293,7 @@ if (!inIframe) {
else { if (showUserMenu) { menuButton.addTo(map); } } else { if (showUserMenu) { menuButton.addTo(map); } }
// Handle the dialog for popup help // Handle the dialog for help box
var dialog = document.querySelector('dialog'); var dialog = document.querySelector('dialog');
dialogPolyfill.registerDialog(dialog); dialogPolyfill.registerDialog(dialog);
document.getElementById('showHelp').onclick = function() { document.getElementById('showHelp').onclick = function() {
@ -373,7 +367,7 @@ function setMaxAge() {
maxage = document.getElementById('maxage').value; maxage = document.getElementById('maxage').value;
if (stale) { clearInterval(stale); } if (stale) { clearInterval(stale); }
//if (maxage > 0) { //if (maxage > 0) {
stale = setInterval( function() { doTidyUp() }, 20000); // every 20 secs stale = setInterval( function() { doTidyUp() }, 20000); // check every 20 secs
//} //every minute //} //every minute
//console.log("Stale time set :",maxage+"s"); //console.log("Stale time set :",maxage+"s");
} }
@ -394,7 +388,7 @@ function setCluster(v) {
showMapCurrentZoom(); showMapCurrentZoom();
} }
// Search for markers with names of .... // Search for markers with names of ... or icons of ...
function doSearch() { function doSearch() {
var value = document.getElementById('search').value; var value = document.getElementById('search').value;
marks = []; marks = [];
@ -489,14 +483,14 @@ function toggleMenu() {
} }
} }
function openMenu(){ function openMenu() {
if (!menuOpen) { if (!menuOpen) {
menuOpen = true; menuOpen = true;
document.getElementById("menu").style.display = 'block'; document.getElementById("menu").style.display = 'block';
} }
} }
function closeMenu(){ function closeMenu() {
if (menuOpen) { if (menuOpen) {
menuOpen = false; menuOpen = false;
document.getElementById("menu").style.display = 'none'; document.getElementById("menu").style.display = 'none';
@ -533,7 +527,6 @@ map.on('overlayadd', function(e) {
clrHeat.addTo(map); clrHeat.addTo(map);
} }
if (e.name == "day/night") { if (e.name == "day/night") {
//console.log("add daynight");
layers["_daynight"].addLayer(L.terminator()); layers["_daynight"].addLayer(L.terminator());
} }
if (e.name == "drawing") { if (e.name == "drawing") {
@ -551,14 +544,12 @@ map.on('overlayremove', function(e) {
clrHeat.removeFrom(map); clrHeat.removeFrom(map);
} }
if (e.name == "day/night") { if (e.name == "day/night") {
//console.log("del daynight");
layers["_daynight"].clearLayers(); layers["_daynight"].clearLayers();
} }
if (e.name == "drawing") { if (e.name == "drawing") {
//map.removeControl(colorControl); //map.removeControl(colorControl);
map.removeControl(drawControl); map.removeControl(drawControl);
} }
//else console.log("layer del :",e.name);
ws.send(JSON.stringify({action:"dellayer", name:e.name})); ws.send(JSON.stringify({action:"dellayer", name:e.name}));
}); });
@ -809,11 +800,6 @@ overlays["countries"] = layers["_countries"];
layers["_daynight"] = new L.LayerGroup(); layers["_daynight"] = new L.LayerGroup();
overlays["day/night"] = layers["_daynight"]; overlays["day/night"] = layers["_daynight"];
// Add the heatmap layer
var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}});
layers["_heat"] = new L.LayerGroup().addLayer(heat);
overlays["heatmap"] = layers["_heat"];
// Add the drawing layer for fun... // Add the drawing layer for fun...
layers["_drawing"] = new L.FeatureGroup(); layers["_drawing"] = new L.FeatureGroup();
overlays["drawing"] = layers["_drawing"]; overlays["drawing"] = layers["_drawing"];
@ -822,7 +808,7 @@ var drawControl = new L.Control.Draw({
polyline: { shapeOptions: { clickable:false } }, polyline: { shapeOptions: { clickable:false } },
marker: false, marker: false,
circle: false, circle: false,
//circle: { shapeOptions: { clickable:false } }, // circle: { shapeOptions: { clickable:false } },
rectangle: { shapeOptions: { clickable:true } }, rectangle: { shapeOptions: { clickable:true } },
polygon: { shapeOptions: { clickable:true } }, polygon: { shapeOptions: { clickable:true } },
}, },
@ -841,7 +827,12 @@ map.on('draw:created', function (e) {
layers["_drawing"].addLayer(layer); layers["_drawing"].addLayer(layer);
}); });
// Add the heatmap layer
var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}});
layers["_heat"] = new L.LayerGroup().addLayer(heat);
overlays["heatmap"] = layers["_heat"];
// Add the buildings layer
overlays["buildings"] = new OSMBuildings(map).load(); overlays["buildings"] = new OSMBuildings(map).load();
map.removeLayer(overlays["buildings"]); // Hide it at start map.removeLayer(overlays["buildings"]); // Hide it at start

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 600 60"
height="60"
width="600"
id="svg4225"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="spritesheet.svg"
inkscape:export-filename="/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<metadata
id="metadata4258">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4256" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview4254"
showgrid="false"
inkscape:zoom="1.3101852"
inkscape:cx="237.56928"
inkscape:cy="7.2419621"
inkscape:window-x="1920"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg4225" />
<g
id="enabled"
style="fill:#464646;fill-opacity:1">
<g
id="polyline"
style="fill:#464646;fill-opacity:1">
<path
d="m 18,36 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
id="path4229"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 36,18 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
id="path4231"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 23.142,39.145 -2.285,-2.29 16,-15.998 2.285,2.285 z"
id="path4233"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
<path
id="polygon"
d="M 100,24.565 97.904,39.395 83.07,42 76,28.773 86.463,18 Z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="rectangle"
d="m 140,20 20,0 0,20 -20,0 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="circle"
d="m 221,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="marker"
d="m 270,19 c -4.971,0 -9,4.029 -9,9 0,4.971 5.001,12 9,14 4.001,-2 9,-9.029 9,-14 0,-4.971 -4.029,-9 -9,-9 z m 0,12.5 c -2.484,0 -4.5,-2.014 -4.5,-4.5 0,-2.484 2.016,-4.5 4.5,-4.5 2.485,0 4.5,2.016 4.5,4.5 0,2.486 -2.015,4.5 -4.5,4.5 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<g
id="edit"
style="fill:#464646;fill-opacity:1">
<path
d="m 337,30.156 0,0.407 0,5.604 c 0,1.658 -1.344,3 -3,3 l -10,0 c -1.655,0 -3,-1.342 -3,-3 l 0,-10 c 0,-1.657 1.345,-3 3,-3 l 6.345,0 3.19,-3.17 -9.535,0 c -3.313,0 -6,2.687 -6,6 l 0,10 c 0,3.313 2.687,6 6,6 l 10,0 c 3.314,0 6,-2.687 6,-6 l 0,-8.809 -3,2.968"
id="path4240"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 338.72,24.637 -8.892,8.892 -2.828,0 0,-2.829 8.89,-8.89 z"
id="path4242"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 338.697,17.826 4,0 0,4 -4,0 z"
transform="matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)"
id="path4244"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
<g
id="remove"
style="fill:#464646;fill-opacity:1">
<path
d="m 381,42 18,0 0,-18 -18,0 0,18 z m 14,-16 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z"
id="path4247"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 395,20 0,-4 -10,0 0,4 -6,0 0,2 22,0 0,-2 -6,0 z m -2,0 -6,0 0,-2 6,0 0,2 z"
id="path4249"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
</g>
<g
id="disabled"
transform="translate(120,0)"
style="fill:#bbbbbb">
<use
xlink:href="#edit"
id="edit-disabled"
x="0"
y="0"
width="100%"
height="100%" />
<use
xlink:href="#remove"
id="remove-disabled"
x="0"
y="0"
width="100%"
height="100%" />
</g>
<path
style="fill:none;stroke:#464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle-3"
d="m 581.65725,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

File diff suppressed because one or more lines are too long