Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out of need, gh-pages #31

Open
wants to merge 29 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f97c4b2
Fixed repos link in header
jawj May 6, 2012
33aa37e
Fixed a stray google.maps reference
jawj May 7, 2012
c1df66a
Remove incorrect GMaps references
mourner Jul 23, 2012
ef97a81
Merge pull request #2 from mourner/patch-1
jawj Jul 23, 2012
9f42beb
Fix textile syntax for merged change.
jawj Jul 23, 2012
8cce6a6
Now checking that marker is added to map when iterating over candidat…
jawj Oct 14, 2013
cc37374
Fix demo map source URL
ryanjhodge Feb 27, 2016
7422a80
Merge pull request #26 from ryanjhodge/master
jawj May 10, 2016
8758372
make compatible with other types of markers that don't have available…
robertleeplummerjr Jun 3, 2016
d970eea
cleanup build process
robertleeplummerjr Jun 3, 2016
255fd03
add index.html for demoing
robertleeplummerjr Jun 4, 2016
ddd4bf8
add image and rename map_canvas to map for clarity
robertleeplummerjr Jun 4, 2016
51faf40
add coffeescript as a dependency
robertleeplummerjr Jun 4, 2016
4966809
add leaflet from bower so demo works in browser
robertleeplummerjr Jun 4, 2016
c7eb9cc
minor cleanup
robertleeplummerjr Jun 4, 2016
92dd7dc
Merge branch 'master' into gh-pages
robertleeplummerjr Jun 4, 2016
fbe635f
Add canvas blurb
robertleeplummerjr Jun 4, 2016
bd79036
Merge branch 'master' into gh-pages
robertleeplummerjr Jun 4, 2016
7412169
simplify syntax
robertleeplummerjr Jun 8, 2016
e3fb636
Merge branch 'master' into gh-pages
robertleeplummerjr Jun 8, 2016
c7eac26
added logic checks and cleanup
robertleeplummerjr Jun 11, 2016
4c60a17
Merge branch 'master' into gh-pages
robertleeplummerjr Jun 11, 2016
e3bd7c3
ensure coffee-script is added as a dependency
robertleeplummerjr Jun 12, 2016
3fa4cd5
empty array check
robertleeplummerjr Jun 12, 2016
b552050
null check
robertleeplummerjr Jun 12, 2016
10f913b
convert circleStartAngle to degrees rather than radians for the human…
robertleeplummerjr Jun 25, 2016
7590dd1
mostly working simple spiderfy control with more normalized variables…
robertleeplummerjr Jun 26, 2016
0c09642
change name
robertleeplummerjr Jun 26, 2016
aca1486
Merge branch 'master' into gh-pages
robertleeplummerjr Jun 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ h1. Overlapping Marker Spiderfier for Leaflet

*Ever noticed how, in "Google Earth":http://earth.google.com, marker pins that overlap each other spring apart gracefully when you click them, so you can pick the one you meant?*

*And ever noticed how, when using the "Leaflet API":http://code.google.com/apis/maps/documentation/javascript/, the same thing doesn't happen?*
*And ever noticed how, when using the "Leaflet API":http://leaflet.cloudmade.com, the same thing doesn't happen?*

This code makes Leaflet map markers behave in that Google Earth way (minus the animation). Small numbers of markers (yes, up to 8) spiderfy into a circle. Larger numbers fan out into a more space-efficient spiral.

Expand All @@ -18,15 +18,15 @@ That might be what you want. However, it probably *isn't* what you want (or isn'

h2. Demo

See the "demo map":http://jawj.github.com/OverlappingMarkerSpiderfier-Leaflet/demo.html (the data is random: reload the map to reposition the markers).
See the "demo map":http://jawj.github.com/OverlappingMarkerSpiderfier-Leaflet/ (the data is random: reload the map to reposition the markers).

h2. Download

Download "the compiled, minified JS source":http://jawj.github.com/OverlappingMarkerSpiderfier-Leaflet/bin/oms.min.js.
Download "the compiled JS source":http://jawj.github.com/OverlappingMarkerSpiderfier-Leaflet/oms.js.

h2. How to use

See the "demo map source":/jawj/OverlappingMarkerSpiderfier-Leaflet/blob/gh-pages/demo.html, or follow along here for a slightly simpler usage with commentary.
See the "demo map source":http://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet/blob/gh-pages/index.html, or follow along here for a slightly simpler usage with commentary.

Create your map like normal (using the beautiful "Stamen watercolour OSM map":http://maps.stamen.com/#watercolor):

Expand All @@ -38,7 +38,7 @@ Create an @OverlappingMarkerSpiderfier@ instance:

bc. var oms = new OverlappingMarkerSpiderfier(map);

Instead of adding click listeners to your markers directly via @google.maps.event.addListener@, add a global listener on the @OverlappingMarkerSpiderfier@ instance instead. The listener will be passed the clicked marker as its first argument.
Instead of adding click listeners to your markers directly via @marker.addEventListener@ or @marker.on@, add a global listener on the @OverlappingMarkerSpiderfier@ instance instead. The listener will be passed the clicked marker as its first argument.

bc. var popup = new L.Popup();
oms.addListener('click', function(marker) {
Expand Down Expand Up @@ -125,7 +125,7 @@ Adds a listener to react to one of three events.

@event@ may be @'click'@, @'spiderfy'@ or @'unspiderfy'@.

For @'click'@ events, @listenerFunc@ receives one argument: the clicked marker object. You'll probably want to use this listener to do something like show a @google.maps.InfoWindow@.
For @'click'@ events, @listenerFunc@ receives one argument: the clicked marker object. You'll probably want to use this listener to do something like show an @L.Popup@.

For @'spiderfy'@ or @'unspiderfy'@ events, @listenerFunc@ receives two arguments: first, an @Array@ of the markers that were spiderfied or unspiderfied; second, an @Array@ of the markers that were not. One use for these listeners is to make some distinction between spiderfied and non-spiderfied markers when some markers are spiderfied -- e.g. highlighting those that are spiderfied, or dimming out those that aren't.

Expand All @@ -151,6 +151,9 @@ These determine the usual and highlighted colours of the lines.

You can also get and set any of the options noted in the constructor function documentation above as properties on an OverlappingMarkerSpiderfier instance.

h3. Canvas
Leaflet.spiderfy is 100% compliant with Leaflet's canvas renderer. Simply place `window.L_PREFER_CANVAS = true` before loading leaflet, and robert it your mother's brother.

h2. Licence

This software is released under the "MIT licence":http://www.opensource.org/licenses/mit-license.php.
31 changes: 31 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "leaflet.spiderfy",
"homepage": "https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet",
"authors": [
"George MacKerron <[email protected]>"
],
"description": "Overlapping Marker Spiderfier for Leaflet",
"main": "oms.js",
"keywords": [
"leaflet",
"cluster",
"spider",
"spiderfy",
"group",
"markers"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"leaflet": "0.7.3"
},
"devDependencies": {
"coffee-script": "^1.10.0"
}
}
35 changes: 35 additions & 0 deletions bower_components/leaflet/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "leaflet",
"version": "0.7.3",
"description": "JavaScript library for mobile-friendly interactive maps",
"main": [
"dist/leaflet.js",
"dist/leaflet.css",
"dist/leaflet-src.js",
"dist/images/layers-2x.png",
"dist/images/layers.png",
"dist/images/marker-icon-2x.png",
"dist/images/marker-icon.png",
"dist/images/marker-shadow.png"
],
"ignore": [
".*",
"CHANGELOG.json",
"FAQ.md",
"debug",
"spec",
"src",
"build"
],
"homepage": "https://github.com/Leaflet/Leaflet",
"_release": "0.7.3",
"_resolution": {
"type": "version",
"tag": "v0.7.3",
"commit": "8a5fdfc6e3db2807b8f0dd617474e4ab2949142b"
},
"_source": "https://github.com/Leaflet/Leaflet.git",
"_target": "0.7.3",
"_originalSource": "leaflet",
"_direct": true
}
Loading