mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
polyline styling options - attempt 2
This commit is contained in:
@@ -33,6 +33,7 @@ By default the Clusterer enables some nice defaults for you:
|
||||
* **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds.
|
||||
* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. (*Note: the spiderfy occurs at the current zoom level if all items within the cluster are physically located at the same latitude and longitude.*)
|
||||
* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
|
||||
* **spiderLegPolylineOptions**: Allows you to specify [PolylineOptions](http://leafletjs.com/reference.html#polyline-options) to style spider legs. By default, they are `{ weight: 1.5, color: '#222' }`.
|
||||
|
||||
You can disable any of these as you want in the options when you create the MarkerClusterGroup:
|
||||
```javascript
|
||||
|
||||
@@ -136,8 +136,8 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
||||
|
||||
fg.addLayer(m);
|
||||
|
||||
|
||||
leg = new L.Polyline([this._latlng, newPos], { weight: 1.5, color: '#222' });
|
||||
var legOptions = this._group.options.spiderLegPolylineOptions;
|
||||
leg = new L.Polyline([this._latlng, newPos], legOptions);
|
||||
map.addLayer(leg);
|
||||
m._spiderLeg = leg;
|
||||
}
|
||||
@@ -201,7 +201,11 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
||||
|
||||
|
||||
//Add Legs.
|
||||
leg = new L.Polyline([me._latlng, newPos], { weight: 1.5, color: '#222', opacity: initialLegOpacity });
|
||||
var legOptions = this._group.options.spiderLegPolylineOptions;
|
||||
if (legOptions.opacity === undefined) {
|
||||
legOptions.opacity = initialLegOpacity;
|
||||
}
|
||||
leg = new L.Polyline([me._latlng, newPos], legOptions);
|
||||
map.addLayer(leg);
|
||||
m._spiderLeg = leg;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
//Increase to increase the distance away that spiderfied markers appear from the center
|
||||
spiderfyDistanceMultiplier: 1,
|
||||
|
||||
// Make it possible to specify a polyline options on a spider leg
|
||||
spiderLegPolylineOptions: { weight: 1.5, color: '#222' },
|
||||
|
||||
// When bulk adding layers, adds markers in chunks. Means addLayers may not add all the layers in the call, others will be loaded during setTimeouts
|
||||
chunkedLoading: false,
|
||||
chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback)
|
||||
|
||||
Reference in New Issue
Block a user