{"_id":"ts-overlapping-marker-spiderfier-leaflet","_rev":"7-c2fc6c574eb8ecd91784ef5239858eb9","name":"ts-overlapping-marker-spiderfier-leaflet","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.2":{"name":"ts-overlapping-marker-spiderfier-leaflet","version":"1.0.2","keywords":["leaflet","spiderfier"],"author":{"name":"Alex Laisney"},"license":"MIT","_id":"ts-overlapping-marker-spiderfier-leaflet@1.0.2","maintainers":[{"name":"draxare","email":"alexlaisney@yahoo.com"}],"homepage":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet#readme","bugs":{"url":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet/issues"},"dist":{"shasum":"cb9446b4c5b5eebee53d9a0c6d72e407f3abeda3","tarball":"https://registry.npmjs.org/ts-overlapping-marker-spiderfier-leaflet/-/ts-overlapping-marker-spiderfier-leaflet-1.0.2.tgz","fileCount":21,"integrity":"sha512-MbsWiuQwAPq58MKRluyr2QsqFsfbEEBdQ4nuDhNU/gJe0Yc5/D3uuyUkREGLpKMBWg9TrNtZ4Ef2zskZ0LII0g==","signatures":[{"sig":"MEUCIEL5VWDeCn4IC+QvrHZpHiUuCty21jY4m/JYpzrQvvypAiEAzI0MmazJ/1dJ02wvZuhKmOTMiyzDDM7rPgTLPWGddpA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":248235},"main":"./dist/index.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"b040db326ad7cd7f9327cbedcda9c853a16f10e0","scripts":{"build":"npm run clean && npm run build:tsc && npm run build:packs","clean":"rimraf ./dist","build:tsc":"tsc","build:packs":"rollup -c rollup.config.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"draxare","email":"alexlaisney@yahoo.com"},"repository":{"url":"git+https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet.git","type":"git"},"_npmVersion":"10.8.2","description":"Overlapping Marker Spiderfier Leaflet","directories":{},"_nodeVersion":"20.18.0","dependencies":{"@types/leaflet":"^1.9.15"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^2.6.2","rollup":"^4.29.1","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/ts-overlapping-marker-spiderfier-leaflet_1.0.2_1735150273747_0.486578054035234","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"ts-overlapping-marker-spiderfier-leaflet","version":"1.0.3","keywords":["leaflet","spiderfier"],"author":{"name":"Alex Laisney"},"license":"MIT","_id":"ts-overlapping-marker-spiderfier-leaflet@1.0.3","maintainers":[{"name":"draxare","email":"alexlaisney@yahoo.com"}],"homepage":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet#readme","bugs":{"url":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet/issues"},"dist":{"shasum":"869fb56c49ad005a14c65c1661099b70eab9ea43","tarball":"https://registry.npmjs.org/ts-overlapping-marker-spiderfier-leaflet/-/ts-overlapping-marker-spiderfier-leaflet-1.0.3.tgz","fileCount":21,"integrity":"sha512-pzO6Uq/TjzMY35MSzaeulYOjoVQZSLC9M94Fgzu0FqT0xTMKUDr0WL2Vjp4D0npxNMGPg8eO/QiX7VJ12Ew3AA==","signatures":[{"sig":"MEYCIQDW8xQDRuayArxrY5NFQ7HBkqd5M6yi5x/zbjipaPsw0wIhAOcq5d5qwoquTN5O/Non7cfkeEEZvJ5EVpwz21TXhIRC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":250473},"main":"./dist/index.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"7ad3f87596f74f316002f1e89a88bbb28ee0b5d1","scripts":{"build":"npm run clean && npm run build:tsc && npm run build:packs","clean":"rimraf ./dist","build:tsc":"tsc","build:packs":"rollup -c rollup.config.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"draxare","email":"alexlaisney@yahoo.com"},"repository":{"url":"git+https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet.git","type":"git"},"_npmVersion":"10.8.2","description":"Overlapping Marker Spiderfier Leaflet","directories":{},"_nodeVersion":"20.18.0","dependencies":{"@types/leaflet":"^1.9.15"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^2.6.2","rollup":"^4.29.1","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/ts-overlapping-marker-spiderfier-leaflet_1.0.3_1735150496130_0.5981016485427688","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"ts-overlapping-marker-spiderfier-leaflet","version":"1.0.4","keywords":["leaflet","spiderfier"],"author":{"name":"Alex Laisney"},"license":"MIT","_id":"ts-overlapping-marker-spiderfier-leaflet@1.0.4","maintainers":[{"name":"draxare","email":"alexlaisney@yahoo.com"}],"homepage":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet#readme","bugs":{"url":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet/issues"},"dist":{"shasum":"3e45a972144550042519d49b135a3ef38040e165","tarball":"https://registry.npmjs.org/ts-overlapping-marker-spiderfier-leaflet/-/ts-overlapping-marker-spiderfier-leaflet-1.0.4.tgz","fileCount":21,"integrity":"sha512-QnhyPZkw3GOqOLPxFToQJFrvP/lNApltg7ZexaxQoFGRKl8SMawi9LhBmZL7r7I5/28kki4v8Hs5kMBF5Ui+YQ==","signatures":[{"sig":"MEUCIF4o8tOtSdOSRN1a1CzXtb2RcFG6zZ8dGJVq1bNv0rf0AiEAzsWn4b7ZfaIYDH95hv0OC5EvN1CsrrLVac+95UWtEPY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163031},"main":"./dist/index.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"609afe23f6385b85379ae392cf0e13c643067a0d","scripts":{"build":"npm run clean && npm run build:tsc && npm run build:packs","clean":"rimraf ./dist","build:tsc":"tsc","build:packs":"rollup -c rollup.config.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"draxare","email":"alexlaisney@yahoo.com"},"repository":{"url":"git+https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet.git","type":"git"},"_npmVersion":"10.8.2","description":"Overlapping Marker Spiderfier Leaflet","directories":{},"_nodeVersion":"20.18.0","dependencies":{"@types/leaflet":"^1.9.15"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^2.6.2","rollup":"^4.29.1","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/ts-overlapping-marker-spiderfier-leaflet_1.0.4_1735153554919_0.03157299824014781","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"ts-overlapping-marker-spiderfier-leaflet","version":"1.0.5","description":"Overlapping Marker Spiderfier Leaflet","main":"./dist/index.umd.js","module":"./dist/index.js","types":"./dist/index.d.ts","author":{"name":"Alex Laisney"},"homepage":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet#readme","license":"MIT","type":"module","bugs":{"url":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet/issues"},"keywords":["leaflet","spiderfier"],"repository":{"type":"git","url":"git+https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet.git"},"scripts":{"clean":"rimraf ./dist","build":"npm run clean && npm run build:tsc && npm run build:packs","build:tsc":"tsc","build:packs":"rollup -c rollup.config.mjs","prepublishOnly":"npm run build"},"dependencies":{"@types/leaflet":"^1.9.15"},"devDependencies":{"rimraf":"^2.6.2","rollup":"^4.29.1","typescript":"^5.7.2"},"_id":"ts-overlapping-marker-spiderfier-leaflet@1.0.5","gitHead":"49e8fe1c1299a708d11223b603351ffd72aba9af","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-D2GiNFeHStohz7CLg7O7UDbuPHSDHQHtx/qNaO55/EDaACkln9dGDiV6+hJKGwXcTDvckDjLFR2QgNywJWCyxA==","shasum":"e9d5229171d1e6814c5a4ed02f76e6c4f2740369","tarball":"https://registry.npmjs.org/ts-overlapping-marker-spiderfier-leaflet/-/ts-overlapping-marker-spiderfier-leaflet-1.0.5.tgz","fileCount":21,"unpackedSize":162378,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8KZUcDB/XTp8BMCwwlNhD7DbTEkd9TBogt0RvG4ngBgIhAOeluebods+e8r6TOmrnR0tzo3p2tfrH2ankzAqb2qJv"}]},"_npmUser":{"name":"draxare","email":"alexlaisney@yahoo.com"},"directories":{},"maintainers":[{"name":"draxare","email":"alexlaisney@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ts-overlapping-marker-spiderfier-leaflet_1.0.5_1735223170568_0.9796612001675302"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-25T18:11:13.747Z","modified":"2024-12-26T14:26:10.956Z","1.0.0":"2024-12-24T16:36:08.575Z","1.0.1":"2024-12-24T16:48:42.651Z","1.0.11":"2024-12-24T16:51:42.248Z","1.0.2":"2024-12-25T18:11:13.980Z","1.0.3":"2024-12-25T18:14:56.402Z","1.0.4":"2024-12-25T19:05:55.171Z","1.0.5":"2024-12-26T14:26:10.784Z"},"bugs":{"url":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet/issues"},"author":{"name":"Alex Laisney"},"license":"MIT","homepage":"https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet#readme","keywords":["leaflet","spiderfier"],"repository":{"type":"git","url":"git+https://github.com/Draxare/ts-overlapping-marker-spiderfier-leaflet.git"},"description":"Overlapping Marker Spiderfier Leaflet","maintainers":[{"name":"draxare","email":"alexlaisney@yahoo.com"}],"readme":"# ts-overlapping-marker-spiderfier-leaflet\n\nThis is a fork of jawj's [OverlappingMarkerSpiderfier-Leaflet](https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet), rewritten in TypeScript. It is inspired by chancezeus's [ts-overlapping-marker-spiderfier](https://github.com/chancezeus/oms) but for leaflet. This version is designed for use with Angular and other Webpack-based systems.\n\n\n## Table of Contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Original Readme](#original-readme)\n  * [How to use](#how-to-use)\n  * [Docs](#docs)\n* [License](#license)\n\n## Installation\n\nTo install this package, use npm:\n\n```sh\nnpm install ts-overlapping-marker-spiderfier-leaflet\n```\n\n## Usage\n\nInstead of binding itself to window you can\n`import {OverlappingMarkerSpiderfier} from 'ts-overlapping-marker-spiderfier-leaflet'` and use the module as you would normally.\n\nOther variants (`umd`, `cjs`, `amd` and `browser`) are provided using rollup and can be found in the `dist` folder. For\n`umd` and `browser` the module will bind itself to the `omsleaflet` namespace, so accessing the module code can be done using\n`new omsleaflet.OverlappingMarkerSpiderfier...` instead of `new OverlappingMarkerSpiderfier...`.\n\n## Original Readme\n\n*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?*\n\n*And ever noticed how, when using the [Leaflet API](http://leaflet.cloudmade.com), the same thing doesn't happen?*\n\nThis 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.\n\nThe compiled code has no dependencies beyond Leaflet. And it's under 3K when compiled out of [CoffeeScript](http://jashkenas.github.com/coffee-script/), minified with Google's [Closure Compiler](http://code.google.com/closure/compiler/) and gzipped.\n\nIt's a port of my [original library for the Google Maps API](https://github.com/jawj/OverlappingMarkerSpiderfier). (Since the Leaflet API doesn't let us observe all the event types that the Google one does, the main difference between the original and the port is this: you must first call `unspiderfy` if and when you want to move a marker in the Leaflet version).\n\n## Doesn't clustering solve this problem?\n\nYou may have seen the marker clustering libraries, which also help deal with markers that are close together.\n\nThat might be what you want. However, it probably *isn't* what you want (or isn't the only thing you want) if you have markers that could be in the exact same location, or close enough to overlap even at the maximum zoom level. In that case, clustering won't help your users see and/or click on the marker they're looking for.\n\n## Demo\n\nSee the [demo map](http://jawj.github.io/OverlappingMarkerSpiderfier-Leaflet/demo.html) (the data is random: reload the map to reposition the markers).\n\n## Download\n\nDownload [the compiled, minified JS source](http://jawj.github.com/OverlappingMarkerSpiderfier-Leaflet/bin/oms.min.js).\n\nOr use it straight from [cdnjs](https://cdnjs.com/libraries/OverlappingMarkerSpiderfier-Leaflet) `<script src=\"https://cdnjs.cloudflare.com/ajax/libs/OverlappingMarkerSpiderfier-Leaflet/0.2.6/oms.min.js\"></script>`.\n\n## How to use\n\nSee the [demo map source](http://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet/blob/gh-pages/demo.html), or follow along here for a slightly simpler usage with commentary.\n\nCreate your map like normal (using the beautiful \"Stamen watercolour OSM map\":http://maps.stamen.com/#watercolor):\n\n```js\nvar map = new L.Map('map_canvas', {center: new L.LatLng(51.505, -0.09), zoom: 13});\nvar layer = new L.StamenTileLayer('watercolor');\nmap.addLayer(layer);\n```\n\nCreate an `OverlappingMarkerSpiderfier` instance:\n\n```js\nvar oms = new OverlappingMarkerSpiderfier(map);\n```\n\nInstead 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.\n\n```js\nvar popup = new L.Popup();\noms.addListener('click', function(marker) {\n  popup.setContent(marker.desc);\n  popup.setLatLng(marker.getLatLng());\n  map.openPopup(popup);\n});\n```\n  \nYou can also add listeners on the `spiderfy` and `unspiderfy` events, which will be passed an array of the markers affected. In this example, we observe only the `spiderfy` event, using it to close any open `InfoWindow`:\n  \n```js\noms.addListener('spiderfy', function(markers) {\n  map.closePopup();\n});\n```\n\nFinally, tell the `OverlappingMarkerSpiderfier` instance about each marker as you add it, using the `addMarker` method:\n\n```js\nfor (var i = 0; i < window.mapData.length; i ++) {\n  var datum = window.mapData[i];\n  var loc = new L.LatLng(datum.lat, datum.lon);\n  var marker = new L.Marker(loc);\n  marker.desc = datum.d;\n  map.addLayer(marker);\n  oms.addMarker(marker);  // <-- here\n}\n```\n\n## Docs\n\n### Loading\n\nThe Leaflet `L` object must be available when this code runs -- i.e. put the Leaflet API <script> tag before this one. The code has been tested with the 0.4 API version.\n\n\n### Construction\n\n```js\nnew OverlappingMarkerSpiderfier(map, options)`\n```\n\nCreates an instance associated with `map` (an `L.Map`).\n\nThe `options` argument is an optional `Object` specifying any options you want changed from their defaults. The available options are:\n\n```js\nkeepSpiderfied`* (default: `false`)\n```\n\nBy default, the OverlappingMarkerSpiderfier works like Google Earth, in that when you click a spiderfied marker, the markers unspiderfy before any other action takes place. \n\nSince this can make it tricky for the user to work through a set of markers one by one, you can override this behaviour by setting the `keepSpiderfied` option to `true`.\n\n```js\nnearbyDistance`* (default: `20`)\n```\n\nThis is the pixel radius within which a marker is considered to be overlapping a clicked marker.\n\n```js\ncircleSpiralSwitchover`* (default: `9`)\n```\n\nThis is the lowest number of markers that will be fanned out into a spiral instead of a circle. Set this to `0` to always get spirals, or `Infinity` for all circles.\n\n```js\nlegWeight`* (default: `1.5`)\n```\n\nThis determines the thickness of the lines joining spiderfied markers to their original locations. \n\n```js\nInstance methods: managing markers`\n```\n\nNote: methods that have no obvious return value return the OverlappingMarkerSpiderfier instance they were called on, in case you want to chain method calls.\n\n```js\naddMarker(marker)\n```\n\nAdds `marker` (an `L.Marker`) to be tracked.\n\n```js\nremoveMarker(marker)\n```\n\nRemoves `marker` from those being tracked.\n\n```js\nclearMarkers()`\n```\n\nRemoves every `marker` from being tracked. Much quicker than calling `removeMarker` in a loop, since that has to search the markers array every time.\n\n```js\ngetMarkers()\n```\n\nReturns an `Array` of all the markers that are currently being tracked. This is a copy of the one used internally, so you can do what you like with it.\n\n### Instance methods: managing listeners\n\n```js\naddListener(event, listenerFunc)\n```\n\nAdds a listener to react to one of three events.\n`event` may be `'click'`, `'format'`, `'spiderfy'` or `'unspiderfy'`.\n\nFor `'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`.\n\nFor `'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.\n\n```js\nremoveListener(event, listenerFunc)\n```\n\nRemoves the specified listener on the specified event.\n\n```js\nclearListeners(event)\n```\n\nRemoves all listeners on the specified event.\n\n```js\nunspiderfy()\n```\n\nReturns any spiderfied markers to their original positions, and triggers any listeners you may have set for this event. Unless no markers are spiderfied, in which case it does nothing. Be sure to call this before you call `setLatLng` on any tracked marker.\n\n### Properties\n\nYou can set the following properties on an OverlappingMarkerSpiderfier instance:\n\n*`legColors.usual[mapType]`* and *`legColors.highlighted[mapType]`*\n\nThese determine the usual and highlighted colours of the lines. \n\nYou can also get and set any of the options noted in the constructor function documentation above as properties on an OverlappingMarkerSpiderfier instance.\n\n## License\n\nThis software is released under the [MIT licence](http://www.opensource.org/licenses/mit-license.php)\n","readmeFilename":"README.md"}