let clusterAt be set to 0 to disable completely

To close #61
This commit is contained in:
Dave Conway-Jones 2018-12-22 17:05:26 +00:00
parent 456354059c
commit 071007f11c
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
5 changed files with 22 additions and 16 deletions

View File

@ -9,6 +9,7 @@ map web page for plotting "things" on.
### Updates
- v1.5.15 - Allow setting clusterAt to 0 to fully disable it - Issue #61
- v1.5.14 - Stop delete marker feedback to allow updating multiple maps - Issue #59
- v1.5.13 - Send click message to websocket on marker click - Issue #56, #57
- v1.5.11 - Let search also try geocoding lookup if not found in marks.

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "1.5.14",
"version": "1.5.15",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"cgi": "0.3.1",

View File

@ -76,7 +76,7 @@
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
<input type="text" id="node-input-name" placeholder="name">
</div>
<div class="form-tips">Tip: If <i>Path</i> is left empty,
<div class="form-tips">Set clusterAt to 0 to disable.</div><br/>If <i>Path</i> is left empty,
then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
</script>

View File

@ -880,7 +880,11 @@ var delMarker = function(dname,note) {
// the MAIN add something to map function
function setMarker(data) {
//console.log("DATA",typeof data, data);
data = allData[data.name] = Object.assign(allData[data.name]||{},data);
if (data.deleted) { // remove markers we are told to
delMarker(data.name);
return;
}
data = allData[data.name] = Object.assign(allData[data.name] || {}, data);
var ll;
var lli = null;
var opt = {};
@ -908,13 +912,17 @@ function setMarker(data) {
}
var lay = data.layer || "unknown";
if (typeof layers[lay] == "undefined") { // add layer if if doesn't exist
//layers[lay] = new L.LayerGroup();
layers[lay] = new L.MarkerClusterGroup({
maxClusterRadius:50,
spiderfyDistanceMultiplier:1.8,
disableClusteringAtZoom:clusterAt
//zoomToBoundsOnClick:false
});
if (clusterAt > 0) {
layers[lay] = new L.MarkerClusterGroup({
maxClusterRadius:50,
spiderfyDistanceMultiplier:1.8,
disableClusteringAtZoom:clusterAt
//zoomToBoundsOnClick:false
});
}
else {
layers[lay] = new L.LayerGroup();
}
overlays[lay] = layers[lay];
if (showLayerMenu !== false) {
layercontrol.addOverlay(layers[lay],lay);
@ -929,10 +937,7 @@ function setMarker(data) {
}
if (typeof polygons[data.name] != "undefined") { layers[lay].removeLayer(polygons[data.name]); }
if (data.deleted) { // remove markers we are told to
delMarker(data.name);
}
else if (data.hasOwnProperty("line") && Array.isArray(data.line)) {
if (data.hasOwnProperty("line") && Array.isArray(data.line)) {
delete opt.fill;
if (!data.hasOwnProperty("weight")) { opt.weight = 3; } //Standard settings different for lines
if (!data.hasOwnProperty("opacity")) { opt.opacity = 0.8; }
@ -1194,7 +1199,7 @@ function setMarker(data) {
// send new position at end of move event if point is draggable
if (data.draggable === true) {
if (data.icon) { marker.icon = data.icon; }
if (data.iconCOlor) { marker.iconColor = data.iconColor; }
if (data.iconColor) { marker.iconColor = data.iconColor; }
if (data.SIDC) { marker.SIDC = data.SIDC.toUpperCase(); }
marker.on('dragend', function (e) {
var l = marker.getLatLng().toString().replace('LatLng(','lat, lon : ').replace(')','')

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
# date: Dec 12th 2018 - v1.5.14
# date: Dec 22nd 2018 - v1.5.15
CACHE:
index.html