Skip to content
Browse files

Add MIT Licence and update the readme

  • Loading branch information...
1 parent 5c6520c commit 9161de52cc4c89da18a23a6012d511ba00cc2fd9 @danzel danzel committed
Showing with 46 additions and 5 deletions.
  1. +20 −0 MIT-LICENCE.txt
  2. +26 −5 README.md
View
20 MIT-LICENCE.txt
@@ -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.
View
31 README.md
@@ -3,20 +3,21 @@ Leaflet.markercluster
Provides Marker Clustering functionality for Leaflet
-##Using the plugin
-See the included example for usage.
+## Using the plugin
+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
```javascript
var markers = new L.MarkerClusterGroup();
markers.addLayer(new L.Marker(getRandomLatLng(map)));
+... Add more layers ...
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.
The default implementation changes color at bounds of 10 and 100, but more advanced uses may require customising this.
@@ -26,4 +27,24 @@ var markers = new L.MarkerClusterGroup({ options: {
return new L.DivIcon({ html: '<b>' + childCount + '</b>' });
}
}});
-```
+```
+
+### 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.

0 comments on commit 9161de5

Please sign in to comment.
Something went wrong with that request. Please try again.