mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
Add MIT Licence and update the readme
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
Copyright 2012 David Leaver
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -3,20 +3,21 @@ Leaflet.markercluster
|
|||||||
|
|
||||||
Provides Marker Clustering functionality for Leaflet
|
Provides Marker Clustering functionality for Leaflet
|
||||||
|
|
||||||
##Using the plugin
|
## Using the plugin
|
||||||
See the included example for usage.
|
See the included example for usage. Or [check it out online here](http://danzel.github.com/Leaflet.markercluster/example/marker-clustering.html)
|
||||||
|
|
||||||
Create a new MarkerClusterGroup, add your markers to it, then add it to the map
|
Create a new MarkerClusterGroup, add your markers to it, then add it to the map
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var markers = new L.MarkerClusterGroup();
|
var markers = new L.MarkerClusterGroup();
|
||||||
markers.addLayer(new L.Marker(getRandomLatLng(map)));
|
markers.addLayer(new L.Marker(getRandomLatLng(map)));
|
||||||
|
... Add more layers ...
|
||||||
map.addLayer(markers);
|
map.addLayer(markers);
|
||||||
```
|
```
|
||||||
|
|
||||||
For a more complete example see example/marker-clustering.html
|
For the complete example see example/marker-clustering.html
|
||||||
|
|
||||||
###Customising the Clustered Marker
|
### Customising the Clustered Marker
|
||||||
As an option to MarkerClusterGroup you can provide your own function for creating the Icon for the clustered markers.
|
As an option to MarkerClusterGroup you can provide your own function for creating the Icon for the clustered markers.
|
||||||
The default implementation changes color at bounds of 10 and 100, but more advanced uses may require customising this.
|
The default implementation changes color at bounds of 10 and 100, but more advanced uses may require customising this.
|
||||||
|
|
||||||
@@ -27,3 +28,23 @@ var markers = new L.MarkerClusterGroup({ options: {
|
|||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Events
|
||||||
|
|
||||||
|
If you register for click, mouseover, etc events on the MarkerClusterGroup you will get callbacks for both individual markers and clusters.
|
||||||
|
Set your callback up as follows to handle both cases:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
markers.on('click', function (a) {
|
||||||
|
if (a.layer instanceof L.MarkerCluster) {
|
||||||
|
console.log('cluster ' + a.layer.getAllChildMarkers().length);
|
||||||
|
} else {
|
||||||
|
console.log('marker ' + a.layer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
|
||||||
|
Leaflet.markercluster is free software, and may be redistributed under the MIT-LICENSE.
|
||||||
|
|||||||
Reference in New Issue
Block a user