diff --git a/.gitattributes b/.gitattributes
index 12ab58c8f49c0ffb2fc1a91981e794dbe09f6fc7..8df5609f0476f04cf6c2188558c61e690a30a604 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -73,3 +73,6 @@ node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Sorokin.png filter=lfs
node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Wu.png filter=lfs diff=lfs merge=lfs -text
node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin_FloydSteinberg.png filter=lfs diff=lfs merge=lfs -text
node_modules/gifwrap/test/fixtures/rnaples-offsets-public.gif filter=lfs diff=lfs merge=lfs -text
+node_modules/leaflet.markercluster/example/map.png filter=lfs diff=lfs merge=lfs -text
+node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
+node_modules/lightningcss-linux-x64-musl/lightningcss.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
diff --git a/node_modules/leaflet.markercluster/.travis.yml b/node_modules/leaflet.markercluster/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..6e4a9485c25d7a9932a1b85a99aa9a00a384f77b
--- /dev/null
+++ b/node_modules/leaflet.markercluster/.travis.yml
@@ -0,0 +1,25 @@
+sudo: false
+language: node_js
+node_js:
+ - 8
+cache:
+ directories:
+ - "travis_phantomjs"
+ - "$HOME/.npm"
+
+before_install:
+ - "export PHANTOMJS_VERSION=2.1.1"
+ - "hash -r"
+ - "phantomjs --version"
+ - "export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH"
+ - "hash -r"
+ - "phantomjs --version"
+ - "if [ $(phantomjs --version) != \"$PHANTOMJS_VERSION\" ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
+ - "hash -r"
+ - "if [ $(phantomjs --version) != \"$PHANTOMJS_VERSION\" ]; then wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2; fi"
+ - "if [ $(phantomjs --version) != \"$PHANTOMJS_VERSION\" ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
+ - "hash -r"
+ - "phantomjs --version"
+
+install:
+ - npm ci
diff --git a/node_modules/leaflet.markercluster/CHANGELOG.md b/node_modules/leaflet.markercluster/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..8a259edb7e1853473857a8e0e7f3643f6a7ae2be
--- /dev/null
+++ b/node_modules/leaflet.markercluster/CHANGELOG.md
@@ -0,0 +1,268 @@
+# Leaflet.markercluster
+
+(part of repo mgmt responsibilities transferred to [@ykzeng](https://github.com/ykzeng))
+
+## 1.5.3 (2021-10-18)
+
+### Bugfixes
+
+- Removing unnecessary files on npm package
+- Inlucding correct versioning on Github repo
+
+## 1.5.2 (2021-10-18)
+
+### Improvements
+
+- Merged PR [1022](https://github.com/Leaflet/Leaflet.markercluster/pull/1022) for Spiderfy on every room by [MasterEric](https://github.com/MasterEric)
+
+### Bugfixes
+
+- Fixed issue [907](https://github.com/Leaflet/Leaflet.markercluster/issues/907) and [967](https://github.com/Leaflet/Leaflet.markercluster/issues/967) with PR [1027](https://github.com/Leaflet/Leaflet.markercluster/pull/1027) from [DerGuteWolf](https://github.com/DerGuteWolf)
+- Removed unexpected dependencies in previous npm package
+
+## 1.5.1 (2021-08-28)
+
+### Improvements
+
+- Spiderfy on keypress [1005](https://github.com/Leaflet/Leaflet.markercluster/pull/1005) by [@neorth](https://github.com/neorth), a fix for issue [940](https://github.com/Leaflet/Leaflet.markercluster/issues/940) and [947](https://github.com/Leaflet/Leaflet.markercluster/issues/947)
+
+## 1.5.0 (2021-03-12)
+
+### Bugfixes
+
+- Updated peer dependency to match latest leaflet version (by [@sanjpareek](https://github.com/sanjpareek)) [#976](https://github.com/Leaflet/Leaflet.markercluster/pull/976)
+
+(all changes below without author notice were made by [@danzel](https://github.com/danzel))
+
+## 1.4.1 (2018-09-14)
+
+### Bugfixes
+
+- Better support stopping dragged markers from being clustered (by [@DerGuteWolf](https://github.com/DerGuteWolf)) [#909](https://github.com/Leaflet/Leaflet.markercluster/pull/909)
+
+## 1.4.0 (2018-08-22)
+
+Required leaflet version bumped to 1.3.1
+
+### Improvements
+
+- Tests run against leaflet 1.1.0+ [#863](https://github.com/Leaflet/Leaflet.markercluster/issues/863)
+
+### Bugfixes
+
+- Fix clearLayers not removing removed markers [#860](https://github.com/Leaflet/Leaflet.markercluster/issues/860)
+- Remember opacity 0 correctly (by [@r-yanyo](https://github.com/r-yanyo)) [#890](https://github.com/Leaflet/Leaflet.markercluster/pull/890)
+- Fix chunkedLoading LatLngBounds.intersects() (by [@boldtrn](https://github.com/boldtrn)) [#743](https://github.com/Leaflet/Leaflet.markercluster/issues/743) [#891](https://github.com/Leaflet/Leaflet.markercluster/pull/891)
+
+## 1.3.0 (2018-01-19)
+
+### Improvements
+
+- Use Rollup for builds (by [@IvanSanchez](https://github.com/IvanSanchez)) [#769](https://github.com/Leaflet/Leaflet.markercluster/pull/769)
+
+### Bugfixes
+
+- Fix Spiderfier positioning for small markers (by [@ghybs](https://github.com/ghybs)) [#846](https://github.com/Leaflet/Leaflet.markercluster/pull/846)
+- Fix anchor usage with latest leaflet version [#861](https://github.com/Leaflet/Leaflet.markercluster/issues/861)
+
+## 1.2.0 (2017-11-06)
+
+### Improvements
+
+- Move `clusterPane` option in to `options` field (by [@ghybs](https://github.com/ghybs)) [#832](https://github.com/Leaflet/Leaflet.markercluster/pull/832)
+
+### Bugfixes
+
+- Fix very small `maxClusterRadius` hanging the browser (by [@lucaswerkmeister](https://github.com/lucaswerkmeister)) [#838](https://github.com/Leaflet/Leaflet.markercluster/pull/838)
+
+## 1.1.0 (2017-08-27)
+
+### Improvements
+
+- Add `clusterPane` option to allow putting clusters in a different pane (by [@ckrahe](https://github.com/ckrahe)) [#819](https://github.com/Leaflet/Leaflet.markercluster/issues/819)
+
+## 1.0.6 (2017-06-19)
+
+### Bugfixes
+
+- Fix some issues when used with non-integer zoom [#789](https://github.com/Leaflet/Leaflet.markercluster/issues/789)
+- Change examples to use https (by [@ghybs](https://github.com/ghybs)) [#794](https://github.com/Leaflet/Leaflet.markercluster/pull/794)
+
+## 1.0.5 (2017-04-26)
+
+### Improvements
+
+- Allow passing fitBounds options to zoomToBounds (by [@timkelty](https://github.com/timkelty)) [#779](https://github.com/Leaflet/Leaflet.markercluster/pull/779)
+
+### Bugfixes
+
+- Fixed bug where disableClusteringAtZoom being 0 is treated the same as null (by [@MrCheeze](https://github.com/MrCheeze)) [#773](https://github.com/Leaflet/Leaflet.markercluster/pull/773)
+
+## 1.0.4 (2017-03-14)
+
+### Bugfixes
+
+- Fix errors removing a MarkerClusterGroup from the map during an animation [#758](https://github.com/Leaflet/Leaflet.markercluster/issues/758)
+
+## 1.0.3 (2017-02-02)
+
+### Bugfixes
+
+- Fix moving markers while the MarkerClusterGroup is not on the map [#753](https://github.com/Leaflet/Leaflet.markercluster/issues/753)
+
+## 1.0.2 (2017-01-27)
+
+### Improvements
+
+- Support `layeradd` and `layerremove` events [#647](https://github.com/Leaflet/Leaflet.markercluster/issues/647)
+
+### Bugfixes
+
+- Add support for maps with negative minZoom [#704](https://github.com/Leaflet/Leaflet.markercluster/issues/704)
+- Fixed zoomToShowLayer() markers disappearing bug (by [@z3ut](https://github.com/z3ut)) [#739](https://github.com/Leaflet/Leaflet.markercluster/issues/739)
+- Fix an issue when opening a popup inside of zoomToShowLayer
+- If a marker is moved with an open popup on it, re-open the popup after moving it. [#651](https://github.com/Leaflet/Leaflet.markercluster/issues/651)
+
+## 1.0.1 (2017-01-25)
+
+### Improvements
+
+- Add install and build steps with jake (by [@kazes](https://github.com/kazes)) [#733](https://github.com/Leaflet/Leaflet.markercluster/pull/733)
+- Readme improvements (by [@ghybs](https://github.com/ghybs), [@bertyhell](https://github.com/bertyhell)) [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738), [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738
+- Bump all examples to leaflet 1.0.3
+
+### Bugfixes
+
+- Fixed leaflet 1.0.2 bug where clearLayers would throw an exception (by [@marcianoviereck92](https://github.com/marcianoviereck92)) [#746](https://github.com/Leaflet/Leaflet.markercluster/pull/746)
+
+## 1.0.0 (2016-10-03)
+
+### Improvements
+
+- Compatibility with Leaflet 1.0.0 (by [@danzel](https://githum.com/danzel), [@Eschon](https://github.com/Eschon), [@ghybs](https://github.com/ghybs), [@IvanSanchez](https://github.com/IvanSanchez))
+- Support moving markers [#57](https://github.com/Leaflet/Leaflet.markercluster/issues/57)
+- chunkedLoading option to keep browser more responsive during larging a load data set [#292](https://github.com/Leaflet/Leaflet.markercluster/issues/292)
+- maxClusterRadius can be a function (by [@Schwanksta](https://github.com/Schwanksta)) [#298](https://github.com/Leaflet/Leaflet.markercluster/issues/298)
+- Spiderfy without zooming when all markers at same location (by [@rdenniston](https://github.com/rdenniston), [@ghybs](https://github.com/ghybs)) [#415](https://github.com/Leaflet/Leaflet.markercluster/issues/415), [#606](https://github.com/Leaflet/Leaflet.markercluster/issues/606)
+- On becoming visible, markers retain their original opacity. (by [@IvanSanchez](https://github.com/IvanSanchez)) [#444](https://github.com/Leaflet/Leaflet.markercluster/issues/444)
+- Spiderleg Polyline options (by [@mikeatlas](https://github.com/mikeatlas)) [#466](https://github.com/Leaflet/Leaflet.markercluster/issues/466)
+- Extra methods to allow refreshing cluster icons (by [@ghybs](https://github.com/ghybs)) [#564](https://github.com/Leaflet/Leaflet.markercluster/issues/564)
+- Ability to disable animations (by [@ghybs](https://github.com/ghybs)) [#578](https://github.com/Leaflet/Leaflet.markercluster/issues/578)
+- Optimized performance of bulk addLayers and removeLayers (by [@ghybs](https://github.com/ghybs)) [#584](https://github.com/Leaflet/Leaflet.markercluster/issues/584)
+- Replaced spiderfy legs animation from SMIL to CSS transition (by [@ghybs](https://github.com/ghybs)) [#585](https://github.com/Leaflet/Leaflet.markercluster/issues/585)
+- Provide more detailed context information on the spiderfied event (by [@evanvosberg](https://github.com/evanvosberg)) [#421](https://github.com/Leaflet/Leaflet.markercluster/issues/421)
+- Add unspiderfied event
+- Readme updates (by [@ghybs](https://github.com/ghybs), [@tomchadwin](https://github.com/tomchadwin) [@Cyrille37](https://github.com/Cyrille37) [@franckl](https://github.com/franckl) [@mikeatlas](https://github.com/mikeatlas)
+ [@rdenniston](https://github.com/rdenniston) [@maackle](https://github.com/maackle) [@fureigh](https://github.com/fureigh) [@Wildhoney](https://github.com/Wildhoney) [@Schwanksta](https://github.com/Schwanksta) [@frankrowe](https://github.com/frankrowe))
+- Improve adding and removing nested LayerGroups (by [@ghybs](https://github.com/ghybs)) [#624](https://github.com/Leaflet/Leaflet.markercluster/pull/624)
+- Add public unspiderfy method (by [@zverev](https://github.com/zverev)) [#617](https://github.com/Leaflet/Leaflet.markercluster/pull/617)
+- Optimized performance of bulk add with complex icon create function (by [@mlazowik](https://github.com/mlazowik)) [#697](https://github.com/Leaflet/Leaflet.markercluster/pull/697)
+- Remove leaflet from peerDependencies (by [@tyleralves](https://github.com/tyleralves)) [#703](https://github.com/Leaflet/Leaflet.markercluster/pull/703)
+- Simplified \_recursively (by [@ghybs](https://github.com/ghybs)) [#656](https://github.com/Leaflet/Leaflet.markercluster/pull/656)
+
+### Bugfixes
+
+- Fix getBounds when removeOutsideVisibleBounds: false is set. [#321](https://github.com/Leaflet/Leaflet.markercluster/issues/321)
+- Fix zoomToShowLayer fails after initial spiderfy [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
+- Fix cluster not disappearing on Android [#344](https://github.com/Leaflet/Leaflet.markercluster/issues/344)
+- Fix RemoveLayers() when spiderified (by [@Grsmto](https://github.com/Grsmto)) [#358](https://github.com/Leaflet/Leaflet.markercluster/issues/358)
+- Remove lines from map when removing cluster (by [@olive380](https://github.com/olive380)) [#532](https://github.com/Leaflet/Leaflet.markercluster/issues/532)
+- Fix getConvexHull when all markers are located at same latitude (by [@olive380](https://github.com/olive380)) [#533](https://github.com/Leaflet/Leaflet.markercluster/issues/533)
+- Fix removeLayers when cluster is not on the map (by [@eschon](https://github.com/eschon)) [#556](https://github.com/Leaflet/Leaflet.markercluster/issues/556)
+- Improved zoomToShowLayer with callback check (by [@ghybs](https://github.com/ghybs)) [#572](https://github.com/Leaflet/Leaflet.markercluster/issues/572)
+- Improved reliability of RefreshSpec test suite for PhantomJS (by [@ghybs](https://github.com/ghybs)) [#577](https://github.com/Leaflet/Leaflet.markercluster/issues/577)
+- Corrected effect of removeOutsideVisibleBounds option (by [@ghybs](https://github.com/ghybs)) [#575](https://github.com/Leaflet/Leaflet.markercluster/issues/575)
+- Fix getLayer when provided a string [#531](https://github.com/Leaflet/Leaflet.markercluster/issues/531)
+- Documentation improvements (by [@ghybs](https://github.com/ghybs)) [#579](https://github.com/Leaflet/Leaflet.markercluster/issues/579)
+- Correct \_getExpandedVisibleBounds for Max Latitude (by [@ghybs](https://github.com/ghybs)) [#587](https://github.com/Leaflet/Leaflet.markercluster/issues/587)
+- Correct unspiderfy vector (by [@ghybs](https://github.com/ghybs)) [#604](https://github.com/Leaflet/Leaflet.markercluster/issues/604)
+- Remove "leaflet-cluster-anim" class on map remove while spiderfied (by [@ghybs](https://github.com/ghybs)) [#607](https://github.com/Leaflet/Leaflet.markercluster/issues/607)
+- Fix disableClusteringAtZoom maxZoom troubles (by [@OriginalSin](https://github.com/OriginalSin)) [#609](https://github.com/Leaflet/Leaflet.markercluster/issues/609)
+- Fix clusters not disappearing when they were near the edge on mobile (by [@ghybs](https://github.com/ghybs)) [#529](https://github.com/Leaflet/Leaflet.markercluster/issues/529)
+- Remove leaflet from dependencies (by [@ghybs](https://github.com/ghybs)) [#639](https://github.com/Leaflet/Leaflet.markercluster/issues/639)
+- Fix interaction between zoomOrSpiderfy and disableClusteringAtZoom (by [@ghybs](https://github.com/ghybs)) [#633](https://github.com/Leaflet/Leaflet.markercluster/issues/633) [#648](https://github.com/Leaflet/Leaflet.markercluster/issues/648)
+
+## 0.4 (2013-12-19)
+
+### Improvements
+
+- Fix Quick Zoom in/out causing everything to disappear in Firefox (Reported by [@paulovieira](https://github.com/paulovieira)) [#140](https://github.com/Leaflet/Leaflet.markercluster/issues/140)
+- Slow the expand/contract animation down from 200ms to 300ms
+
+### Bugfixes
+
+- Fix some cases zoomToShowLayer wouldn't work (Reported by [@absemetov](https://github.com/absemetov)) [#203](https://github.com/Leaflet/Leaflet.markercluster/issues/203) [#228](https://github.com/Leaflet/Leaflet.markercluster/issues/228) [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
+
+## 0.3 (2013-12-18)
+
+### Improvements
+
+- Work better with custom projections (by [@andersarstrand](https://github.com/andersarstrand)) [#74](https://github.com/Leaflet/Leaflet.markercluster/issues/74)
+- Add custom getBounds that works (Reported by [@2803media](https://github.com/2803media))
+- Allow spacing spiderfied icons further apart (Reported by [@stevevance](https://github.com/stevevance)) [#100](https://github.com/Leaflet/Leaflet.markercluster/issues/100)
+- Add custom eachLayer that works (Reported by [@cilogi](https://github.com/cilogi)) [#102](https://github.com/Leaflet/Leaflet.markercluster/issues/102)
+- Add an option (removeOutsideVisibleBounds) to prevent removing clusters that are outside of the visible bounds (by [@wildhoney](https://github.com/wildhoney)) [#103](https://github.com/Leaflet/Leaflet.markercluster/issues/103)
+- Add getBounds method to cluster (Reported by [@nderambure](https://github.com/nderambure)) [#88](https://github.com/Leaflet/Leaflet.markercluster/issues/88)
+- Lots of unit tests
+- Support having Circle / CircleMarker as child markers
+- Add factory methods (Reported by [@mourner](https://github.com/mourner)) [#21](https://github.com/Leaflet/Leaflet.markercluster/issues/21)
+- Add getVisibleParent method to allow getting the visible parent cluster or the marker if it is visible. (By [@littleiffel](https://github.com/littleiffel)) [#102](https://github.com/Leaflet/Leaflet.markercluster/issues/102)
+- Allow adding non-clusterable things to a MarkerClusterGroup, we don't cluster them. (Reported by [@benbalter](https://github.com/benbalter)) [#195](https://github.com/Leaflet/Leaflet.markercluster/issues/195)
+- removeLayer supports taking a FeatureGroup (Reported by [@pabloalcaraz](https://github.com/pabloalcaraz)) [#236](https://github.com/Leaflet/Leaflet.markercluster/issues/236)
+- DistanceGrid tests, QuickHull tests and improvements (By [@tmcw](https://github.com/tmcw)) [#247](https://github.com/Leaflet/Leaflet.markercluster/issues/247) [#248](https://github.com/Leaflet/Leaflet.markercluster/issues/248) [#249](https://github.com/Leaflet/Leaflet.markercluster/issues/249)
+- Implemented getLayers (Reported by [@metajungle](https://github.com/metajungle)) [#222](https://github.com/Leaflet/Leaflet.markercluster/issues/222)
+- zoomToBounds now only zooms in as far as it needs to to get all of the markers on screen if this is less zoom than zooming to the actual bounds would be (Reported by [@adamyonk](https://github.com/adamyonk)) [#185](https://github.com/Leaflet/Leaflet.markercluster/issues/185)
+- Keyboard accessibility improvements (By [@Zombienaute](https://github.com/Zombienaute)) [#273](https://github.com/Leaflet/Leaflet.markercluster/issues/273)
+- IE Specific css in the default styles is no longer a separate file (By [@frankrowe](https://github.com/frankrowe)) [#280](https://github.com/Leaflet/Leaflet.markercluster/issues/280)
+- Improve usability with small maps (Reported by [@JSCSJSCS](https://github.com/JSCSJSCS)) [#144](https://github.com/Leaflet/Leaflet.markercluster/issues/144)
+- Implement FeatureGroup.getLayer (Reported by [@newmanw](https://github.com/newmanw)) [#244](https://github.com/Leaflet/Leaflet.markercluster/issues/244)
+
+### Bugfixes
+
+- Fix singleMarkerMode when you aren't on the map (by [@duncanparkes](https://github.com/duncanparkes)) [#77](https://github.com/Leaflet/Leaflet.markercluster/issues/77)
+- Fix clearLayers when you aren't on the map (by [@duncanparkes](https://github.com/duncanparkes)) [#79](https://github.com/Leaflet/Leaflet.markercluster/issues/79)
+- IE10 Bug fix (Reported by [@theLundquist](https://github.com/theLundquist)) [#86](https://github.com/Leaflet/Leaflet.markercluster/issues/86)
+- Fixes for hasLayer after removing a layer (Reported by [@cvisto](https://github.com/cvisto)) [#44](https://github.com/Leaflet/Leaflet.markercluster/issues/44)
+- Fix clearLayers not unsetting \_\_parent of the markers, preventing them from being re-added. (Reported by [@apuntovanini](https://github.com/apuntovanini)) [#99](https://github.com/Leaflet/Leaflet.markercluster/issues/99)
+- Fix map.removeLayer(markerClusterGroup) not working (Reported by [@Driklyn](https://github.com/Driklyn)) [#108](https://github.com/Leaflet/Leaflet.markercluster/issues/108)
+- Fix map.addLayers not updating cluster icons (Reported by [@Driklyn](https://github.com/Driklyn)) [#114](https://github.com/Leaflet/Leaflet.markercluster/issues/114)
+- Fix spiderfied clusters breaking if a marker is added to them (Reported by [@Driklyn](https://github.com/Driklyn)) [#114](https://github.com/Leaflet/Leaflet.markercluster/issues/114)
+- Don't show coverage for spiderfied clusters as it will be wrong. (Reported by [@ajbeaven](https://github.com/ajbeaven)) [#95](https://github.com/Leaflet/Leaflet.markercluster/issues/95)
+- Improve zoom in/out immediately making all everything disappear, still issues in Firefox [#140](https://github.com/Leaflet/Leaflet.markercluster/issues/140)
+- Fix animation not stopping with only one marker. (Reported by [@Driklyn](https://github.com/Driklyn)) [#146](https://github.com/Leaflet/Leaflet.markercluster/issues/146)
+- Various fixes for new leaflet (Reported by [@PeterAronZentai](https://github.com/PeterAronZentai)) [#159](https://github.com/Leaflet/Leaflet.markercluster/issues/159)
+- Fix clearLayers when we are spiderfying (Reported by [@skullbooks](https://github.com/skullbooks)) [#162](https://github.com/Leaflet/Leaflet.markercluster/issues/162)
+- Fix removing layers in certain situations (Reported by [@bpavot](https://github.com/bpavot)) [#160](https://github.com/Leaflet/Leaflet.markercluster/issues/160)
+- Support calling hasLayer with null (by [@l0c0luke](https://github.com/l0c0luke)) [#170](https://github.com/Leaflet/Leaflet.markercluster/issues/170)
+- Lots of fixes for removing a MarkerClusterGroup from the map (Reported by [@annetdeboer](https://github.com/annetdeboer)) [#200](https://github.com/Leaflet/Leaflet.markercluster/issues/200)
+- Throw error when being added to a map with no maxZoom.
+- Fixes for markers not appearing after a big zoom (Reported by [@arnoldbird](https://github.com/annetdeboer)) [#216](https://github.com/Leaflet/Leaflet.markercluster/issues/216) (Reported by [@mathilde-pellerin](https://github.com/mathilde-pellerin)) [#260](https://github.com/Leaflet/Leaflet.markercluster/issues/260)
+- Fix coverage polygon not being removed when a MarkerClusterGroup is removed (Reported by [@ZeusTheTrueGod](https://github.com/ZeusTheTrueGod)) [#245](https://github.com/Leaflet/Leaflet.markercluster/issues/245)
+- Fix getVisibleParent when no parent is visible (Reported by [@ajbeaven](https://github.com/ajbeaven)) [#265](https://github.com/Leaflet/Leaflet.markercluster/issues/265)
+- Fix spiderfied markers not hiding on a big zoom (Reported by [@Vaesive](https://github.com/Vaesive)) [#268](https://github.com/Leaflet/Leaflet.markercluster/issues/268)
+- Fix clusters not hiding on a big zoom (Reported by [@versusvoid](https://github.com/versusvoid)) [#281](https://github.com/Leaflet/Leaflet.markercluster/issues/281)
+- Don't fire multiple clustermouseover/off events due to child divs in the cluster marker (Reported by [@heidemn](https://github.com/heidemn)) [#252](https://github.com/Leaflet/Leaflet.markercluster/issues/252)
+
+## 0.2 (2012-10-11)
+
+### Improvements
+
+- Add addLayers/removeLayers bulk add and remove functions that perform better than the individual methods
+- Allow customising the polygon generated for showing the area a cluster covers (by [@yohanboniface](https://github.com/yohanboniface)) [#68](https://github.com/Leaflet/Leaflet.markercluster/issues/68)
+- Add zoomToShowLayer method to zoom down to a marker then call a callback once it is visible
+- Add animateAddingMarkers to allow disabling animations caused when adding/removing markers
+- Add hasLayer
+- Pass the L.MarkerCluster to iconCreateFunction to give more flexibility deciding the icon
+- Make addLayers support geojson layers
+- Allow disabling clustering at a given zoom level
+- Allow styling markers that are added like they were clusters of size 1
+
+### Bugfixes
+
+- Support when leaflet is configured to use canvas rather than SVG
+- Fix some potential crashes in zoom handlers
+- Tidy up when we are removed from the map
+
+## 0.1 (2012-08-16)
+
+Initial Release!
diff --git a/node_modules/leaflet.markercluster/CONTRIBUTING.md b/node_modules/leaflet.markercluster/CONTRIBUTING.md
new file mode 100644
index 0000000000000000000000000000000000000000..e4bfd7d146befcb33bdd260731538699f8efe440
--- /dev/null
+++ b/node_modules/leaflet.markercluster/CONTRIBUTING.md
@@ -0,0 +1,70 @@
+Contributing to Leaflet.MarkerCluster
+=====================================
+
+ 1. [Reporting Bugs](#reporting-bugs)
+ 2. [Contributing Code](#contributing-code)
+ 3. [Building](#building)
+ 4. [Testing](#testing)
+
+## Reporting Bugs
+
+Before reporting a bug on the project's [issues page](https://github.com/Leaflet/Leaflet.markercluster/issues),
+first make sure that your issue is caused by Leaflet.MarkerCluster, not your application code
+(e.g. passing incorrect arguments to methods, etc.).
+Second, search the already reported issues for similar cases,
+and if it's already reported, just add any additional details in the comments.
+
+After you've made sure that you've found a new Leaflet.markercluster bug,
+here are some tips for creating a helpful report that will make fixing it much easier and quicker:
+
+ * Write a **descriptive, specific title**. Bad: *Problem with polylines*. Good: *Doing X in IE9 causes Z*.
+ * Include **browser, OS and Leaflet version** info in the description.
+ * Create a **simple test case** that demonstrates the bug (e.g. using [JSFiddle](http://jsfiddle.net/) or [JS Bin](http://jsbin.com/)).
+ * Check whether the bug can be reproduced in **other browsers**.
+ * Check if the bug occurs in the stable version, master, or both.
+ * *Bonus tip:* if the bug only appears in the master version but the stable version is fine,
+ use `git bisect` to find the exact commit that introduced the bug.
+
+If you just want some help with your project,
+try asking [on the Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js) instead.
+
+## Contributing Code
+
+### Considerations for Accepting Patches
+
+While we happily accept patches, we're also committed to keeping Leaflet simple, lightweight and blazingly fast.
+So bugfixes, performance optimizations and small improvements that don't add a lot of code
+are much more likely to get accepted quickly.
+
+Before sending a pull request with a new feature, check if it's been discussed before already
+(either on [GitHub issues](https://github.com/Leaflet/Leaflet/issues)
+or [Leaflet UserVoice](http://leaflet.uservoice.com/)),
+and ask yourself two questions:
+
+ 1. Are you sure that this new feature is important enough to justify its presence in the Leaflet core?
+ Or will it look better as a plugin in a separate repository?
+ 2. Is it written in a simple, concise way that doesn't add bulk to the codebase?
+
+If your feature or API improvement did get merged into master,
+please consider submitting another pull request with the corresponding [documentation update](#improving-documentation).
+
+## Building
+
+Install the dependencies:
+```
+npm install -g jake
+npm install
+```
+
+Then to build:
+```
+jake
+```
+Output will be in the ```dist/``` directory
+
+## Testing
+
+To run unit tests:
+```
+jake test
+```
diff --git a/node_modules/leaflet.markercluster/ISSUE_TEMPLATE.md b/node_modules/leaflet.markercluster/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000000000000000000000000000000000000..9b1872d5706063dc5733ae7e69cbfb039b8b7658
--- /dev/null
+++ b/node_modules/leaflet.markercluster/ISSUE_TEMPLATE.md
@@ -0,0 +1,23 @@
+- [ ] I'm reporting a bug, not asking for help
+- [ ] I'm sure this is a Leaflet.MarkerCluster code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
+- [ ] I've searched through the issues to make sure it's not yet reported
+
+----
+
+## How to reproduce
+
+- Leaflet version I'm using:
+- Leaflet.MarkerCluster version I'm using:
+- Browser (with version) I'm using:
+- OS/Platform (with version) I'm using:
+- step 1
+- step 2
+
+## What behaviour I'm expecting and which behaviour I'm seeing
+
+## Minimal example reproducing the issue
+
+- [ ] this example is as simple as possible
+- [ ] this example does not rely on any third party code
+
+Using http://leafletjs.com/edit.html or any other jsfiddle-like site.
diff --git a/node_modules/leaflet.markercluster/Jakefile.js b/node_modules/leaflet.markercluster/Jakefile.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f85ed18c69395be2a32237d3d8ba9254f92165b
--- /dev/null
+++ b/node_modules/leaflet.markercluster/Jakefile.js
@@ -0,0 +1,93 @@
+/*
+Leaflet.markercluster building, testing and linting scripts.
+
+To use, install Node, then run the following commands in the project root:
+
+ npm install -g jake
+ npm install
+
+To check the code for errors and build Leaflet from source, run "jake".
+To run the tests, run "jake test".
+
+For a custom build, open build/build.html in the browser and follow the instructions.
+*/
+
+var path = require('path');
+
+desc('Check Leaflet.markercluster source for errors with JSHint');
+task('lint', {
+ async: true
+}, function(){
+ jake.exec('jshint', {
+ printStdout: true
+ }, function () {
+ console.log('\tCheck passed.\n');
+ complete();
+ });
+});
+
+desc('Combine Leaflet.markercluster source files');
+task('build', ['lint'], {
+ async: true
+}, function(){
+ jake.exec('npm run-script rollup', function() {
+ console.log('Rolled up.');
+ complete();
+ });
+});
+
+desc('Compress bundled files');
+task('uglify', ['build'], function(){
+ jake.exec('npm run-script uglify', function() { console.log('Uglyfied.'); });
+});
+
+desc('Run PhantomJS tests');
+task('test', ['lint'], function() {
+
+ var karma = require('karma'),
+ testConfig = {configFile : path.join(__dirname, './spec/karma.conf.js')};
+
+ testConfig.browsers = ['PhantomJS'];
+
+ function isArgv(optName) {
+ return process.argv.indexOf(optName) !== -1;
+ }
+
+ if (isArgv('--chrome')) {
+ testConfig.browsers.push('Chrome');
+ }
+ if (isArgv('--safari')) {
+ testConfig.browsers.push('Safari');
+ }
+ if (isArgv('--ff')) {
+ testConfig.browsers.push('Firefox');
+ }
+ if (isArgv('--ie')) {
+ testConfig.browsers.push('IE');
+ }
+
+ if (isArgv('--cov')) {
+ testConfig.preprocessors = {
+ 'src/**/*.js': 'coverage'
+ };
+ testConfig.coverageReporter = {
+ type : 'html',
+ dir : 'coverage/'
+ };
+ testConfig.reporters = ['coverage'];
+ }
+
+ console.log('Running tests...');
+
+ var server = new karma.Server(testConfig, function(exitCode) {
+ if (!exitCode) {
+ console.log('\tTests ran successfully.\n');
+ complete();
+ } else {
+ process.exit(exitCode);
+ }
+ });
+ server.start();
+});
+
+task('default', ['build', 'uglify']);
diff --git a/node_modules/leaflet.markercluster/MIT-LICENCE.txt b/node_modules/leaflet.markercluster/MIT-LICENCE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..19af06829ce0c79becc5e95efe8131c04e0db972
--- /dev/null
+++ b/node_modules/leaflet.markercluster/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.
diff --git a/node_modules/leaflet.markercluster/README.md b/node_modules/leaflet.markercluster/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..58e8b60ae08a3853a01042fcb89670d4dbcc2d4f
--- /dev/null
+++ b/node_modules/leaflet.markercluster/README.md
@@ -0,0 +1,319 @@
+Leaflet.markercluster
+=====================
+
+Provides Beautiful Animated Marker Clustering functionality for [Leaflet](http://leafletjs.com), a JS library for interactive maps.
+
+*Requires Leaflet 1.0.0*
+
+
+
+For a Leaflet 0.7 compatible version, [use the leaflet-0.7 branch](https://github.com/Leaflet/Leaflet.markercluster/tree/leaflet-0.7)
+For a Leaflet 0.5 compatible version, [Download b128e950](https://github.com/Leaflet/Leaflet.markercluster/archive/b128e950d8f5d7da5b60bd0aa9a88f6d3dd17c98.zip)
+For a Leaflet 0.4 compatible version, [Download the 0.2 release](https://github.com/Leaflet/Leaflet.markercluster/archive/0.2.zip)
+
+
+## Table of Contents
+ * [Using the plugin](#using-the-plugin)
+ * [Building, testing and linting scripts](#building-testing-and-linting-scripts)
+ * [Examples](#examples)
+ * [Usage](#usage)
+ * [Options](#options)
+ * [Defaults](#defaults)
+ * [Customising the Clustered Markers](#customising-the-clustered-markers)
+ * [Customising Spiderfy shape positions](#customising-spiderfy-shape-positions)
+ * [All Options](#all-options)
+ * [Enabled by default (boolean options)](#enabled-by-default-boolean-options)
+ * [Other options](#other-options)
+ * [Chunked addLayers options](#chunked-addlayers-options)
+ * [Events](#events)
+ * [Additional MarkerClusterGroup Events](#additional-markerclustergroup-events)
+ * [Methods](#methods)
+ * [Group methods](#group-methods)
+ * [Adding and removing Markers](#adding-and-removing-markers)
+ * [Bulk adding and removing Markers](#bulk-adding-and-removing-markers)
+ * [Getting the visible parent of a marker](#getting-the-visible-parent-of-a-marker)
+ * [Refreshing the clusters icon](#refreshing-the-clusters-icon)
+ * [Other Group Methods](#other-group-methods)
+ * [Clusters methods](#clusters-methods)
+ * [Getting the bounds of a cluster](#getting-the-bounds-of-a-cluster)
+ * [Zooming to the bounds of a cluster](#zooming-to-the-bounds-of-a-cluster)
+ * [Other clusters methods](#other-clusters-methods)
+ * [Handling LOTS of markers](#handling-lots-of-markers)
+ * [License](#license)
+ * [Sub-plugins](#sub-plugins)
+
+
+## Using the plugin
+Include the plugin CSS and JS files on your page after Leaflet files, using your method of choice:
+* [Download the `v1.4.1` release](https://github.com/Leaflet/Leaflet.markercluster/archive/v1.4.1.zip)
+* Use unpkg CDN: `https://unpkg.com/leaflet.markercluster@1.4.1/dist/`
+* Install with npm: `npm install leaflet.markercluster`
+
+In each case, use files in the `dist` folder:
+* `MarkerCluster.css`
+* `MarkerCluster.Default.css` (not needed if you use your own `iconCreateFunction` instead of the default one)
+* `leaflet.markercluster.js` (or `leaflet.markercluster-src.js` for the non-minified version)
+
+### Building, testing and linting scripts
+Install jake `npm install -g jake` then run `npm install`
+* To check the code for errors and build Leaflet from source, run `jake`.
+* To run the tests, run `jake test`.
+
+### Examples
+See the included examples for usage.
+
+The [realworld example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.
+Or check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for how to customise the behaviour and appearance of the clusterer
+
+### Usage
+Create a new MarkerClusterGroup, add your markers to it, then add it to the map
+
+```javascript
+var markers = L.markerClusterGroup();
+markers.addLayer(L.marker(getRandomLatLng(map)));
+... Add more layers ...
+map.addLayer(markers);
+```
+
+## Options
+### Defaults
+By default the Clusterer enables some nice defaults for you:
+* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
+* **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 still clustered at the maximum zoom level or at zoom specified by `disableClusteringAtZoom` option*)
+* **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', opacity: 0.5 }`.
+
+You can disable any of these as you want in the options when you create the MarkerClusterGroup:
+```javascript
+var markers = L.markerClusterGroup({
+ spiderfyOnMaxZoom: false,
+ showCoverageOnHover: false,
+ zoomToBoundsOnClick: false
+});
+```
+
+### Customising 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.
+You do not need to include the .Default css if you go this way.
+You are passed a MarkerCluster object, you'll probably want to use `getChildCount()` or `getAllChildMarkers()` to work out the icon to show.
+
+```javascript
+var markers = L.markerClusterGroup({
+ iconCreateFunction: function(cluster) {
+ return L.divIcon({ html: '' + cluster.getChildCount() + '' });
+ }
+});
+```
+
+Check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
+
+If you need to update the clusters icon (e.g. they are based on markers real-time data), use the method [refreshClusters()](#refreshing-the-clusters-icon).
+
+### Customising Spiderfy shape positions
+You can also provide a custom function as an option to MarkerClusterGroup to override the spiderfy shape positions. The example below implements linear spiderfy positions which overrides the default circular shape.
+
+```javascript
+var markers = L.markerClusterGroup({
+ spiderfyShapePositions: function(count, centerPt) {
+ var distanceFromCenter = 35,
+ markerDistance = 45,
+ lineLength = markerDistance * (count - 1),
+ lineStart = centerPt.y - lineLength / 2,
+ res = [],
+ i;
+
+ res.length = count;
+
+ for (i = count - 1; i >= 0; i--) {
+ res[i] = new Point(centerPt.x + distanceFromCenter, lineStart + markerDistance * i);
+ }
+
+ return res;
+ }
+});
+```
+
+### All Options
+#### Enabled by default (boolean options)
+* **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers.
+* **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 still clustered at the maximum zoom level or at zoom specified by `disableClusteringAtZoom` option*).
+* **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance.
+* **animate**: Smoothly split / merge cluster children when zooming and spiderfying. If `L.DomUtil.TRANSITION` is false, this option has no effect (no animation is possible).
+
+#### Other options
+* **animateAddingMarkers**: If set to true (and `animate` option is also true) then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it into the cluster. Defaults to false as this gives better performance when bulk adding markers. addLayers does not support this, only addLayer with individual Markers.
+* **disableClusteringAtZoom**: If set, at this zoom level and below, markers will not be clustered. This defaults to disabled. [See Example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html). Note: you may be interested in disabling `spiderfyOnMaxZoom` option when using `disableClusteringAtZoom`.
+* **maxClusterRadius**: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters. You can also use a function that accepts the current map zoom and returns the maximum cluster radius in pixels.
+* **polygonOptions**: Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster. Defaults to empty, which lets Leaflet use the [default Path options](http://leafletjs.com/reference.html#path-options).
+* **singleMarkerMode**: If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster. Note: the markers are not replaced by cluster objects, only their icon is replaced. Hence they still react to normal events, and option `disableClusteringAtZoom` does not restore their previous icon (see [#391](https://github.com/Leaflet/Leaflet.markercluster/issues/391)).
+* **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', opacity: 0.5 }`.
+* **spiderfyDistanceMultiplier**: Increase from 1 to increase the distance away from the center that spiderfied markers are placed. Use if you are using big marker icons (Default: 1).
+* **iconCreateFunction**: Function used to create the cluster icon. See [the default implementation](https://github.com/Leaflet/Leaflet.markercluster/blob/15ed12654acdc54a4521789c498e4603fe4bf781/src/MarkerClusterGroup.js#L542) or the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html).
+* **spiderfyShapePositions**: Function used to override spiderfy default shape positions.
+* **clusterPane**: Map pane where the cluster icons will be added. Defaults to L.Marker's default (currently 'markerPane'). [See the pane example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-pane.html).
+
+#### Chunked addLayers options
+Options for the [addLayers](#bulk-adding-and-removing-markers) method. See [#357](https://github.com/Leaflet/Leaflet.markercluster/issues/357) for explanation on how the chunking works.
+* **chunkedLoading**: Boolean to split the addLayer**s** processing in to small intervals so that the page does not freeze.
+* **chunkInterval**: Time interval (in ms) during which addLayers works before pausing to let the rest of the page process. In particular, this prevents the page from freezing while adding a lot of markers. Defaults to 200ms.
+* **chunkDelay**: Time delay (in ms) between consecutive periods of processing for addLayers. Default to 50ms.
+* **chunkProgress**: Callback function that is called at the end of each chunkInterval. Typically used to implement a progress indicator, e.g. [code in RealWorld 50k](https://github.com/Leaflet/Leaflet.markercluster/blob/master/example/marker-clustering-realworld.50000.html#L33-L49). Defaults to null. Arguments:
+ 1. Number of processed markers
+ 2. Total number of markers being added
+ 3. Elapsed time (in ms)
+
+## Events
+Leaflet events like `click`, `mouseover`, etc. are just related to _Markers_ in the cluster.
+To receive events for clusters, listen to `'cluster' + ''`, ex: `clusterclick`, `clustermouseover`, `clustermouseout`.
+
+Set your callback up as follows to handle both cases:
+
+```javascript
+markers.on('click', function (a) {
+ console.log('marker ' + a.layer);
+});
+
+markers.on('clusterclick', function (a) {
+ // a.layer is actually a cluster
+ console.log('cluster ' + a.layer.getAllChildMarkers().length);
+});
+```
+
+### Additional MarkerClusterGroup Events
+
+- **animationend**: Fires when marker clustering/unclustering animation has completed
+- **spiderfied**: Fires when overlapping markers get spiderified (Contains ```cluster``` and ```markers``` attributes)
+- **unspiderfied**: Fires when overlapping markers get unspiderified (Contains ```cluster``` and ```markers``` attributes)
+
+## Methods
+
+### Group methods
+
+#### Adding and removing Markers
+`addLayer`, `removeLayer` and `clearLayers` are supported and they should work for most uses.
+
+#### Bulk adding and removing Markers
+`addLayers` and `removeLayers` are bulk methods for adding and removing markers and should be favoured over the single versions when doing bulk addition/removal of markers. Each takes an array of markers. You can use [dedicated options](#chunked-addlayers-options) to fine-tune the behaviour of `addLayers`.
+
+These methods extract non-group layer children from Layer Group types, even deeply nested. _However_, be noted that:
+- `chunkProgress` jumps backward when `addLayers` finds a group (since appending its children to the input array makes the total increase).
+- Groups are not actually added into the MarkerClusterGroup, only their non-group child layers. Therfore, `hasLayer` method will return `true` for non-group child layers, but `false` on any (possibly parent) Layer Group types.
+
+If you are removing a lot of markers it will almost definitely be better to call `clearLayers` then call `addLayers` to add the markers you don't want to remove back in. See [#59](https://github.com/Leaflet/Leaflet.markercluster/issues/59#issuecomment-9320628) for details.
+
+#### Getting the visible parent of a marker
+If you have a marker in your MarkerClusterGroup and you want to get the visible parent of it (Either itself or a cluster it is contained in that is currently visible on the map).
+This will return null if the marker and its parent clusters are not visible currently (they are not near the visible viewpoint)
+```javascript
+var visibleOne = markerClusterGroup.getVisibleParent(myMarker);
+console.log(visibleOne.getLatLng());
+```
+
+#### Refreshing the clusters icon
+If you have [customized](#customising-the-clustered-markers) the clusters icon to use some data from the contained markers, and later that data changes, use this method to force a refresh of the cluster icons.
+You can use the method:
+- without arguments to force all cluster icons in the Marker Cluster Group to be re-drawn.
+- with an array or a mapping of markers to force only their parent clusters to be re-drawn.
+- with an L.LayerGroup. The method will look for all markers in it. Make sure it contains only markers which are also within this Marker Cluster Group.
+- with a single marker.
+```javascript
+markers.refreshClusters();
+markers.refreshClusters([myMarker0, myMarker33]);
+markers.refreshClusters({id_0: myMarker0, id_any: myMarker33});
+markers.refreshClusters(myLayerGroup);
+markers.refreshClusters(myMarker);
+```
+
+The plugin also adds a method on L.Marker to easily update the underlying icon options and refresh the icon.
+If passing a second argument that evaluates to `true`, the method will also trigger a `refreshCluster` on the parent MarkerClusterGroup for that single marker.
+```javascript
+// Use as many times as required to update markers,
+// then call refreshClusters once finished.
+for (i in markersSubArray) {
+ markersSubArray[i].refreshIconOptions(newOptionsMappingArray[i]);
+}
+markers.refreshClusters(markersSubArray);
+
+// If updating only one marker, pass true to
+// refresh this marker's parent clusters right away.
+myMarker.refreshIconOptions(optionsMap, true);
+```
+
+#### Other Group Methods
+* **hasLayer**(layer): Returns true if the given layer (marker) is in the MarkerClusterGroup.
+* **zoomToShowLayer**(layer, callback): Zooms to show the given marker (spiderfying if required), calls the callback when the marker is visible on the map.
+
+### Clusters methods
+The following methods can be used with clusters (not the group). They are typically used for event handling.
+
+#### Getting the bounds of a cluster
+When you receive an event from a cluster you can query it for the bounds.
+```javascript
+markers.on('clusterclick', function (a) {
+ var latLngBounds = a.layer.getBounds();
+});
+```
+
+You can also query for the bounding convex polygon.
+See [example/marker-clustering-convexhull.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
+```javascript
+markers.on('clusterclick', function (a) {
+ map.addLayer(L.polygon(a.layer.getConvexHull()));
+});
+```
+
+#### Zooming to the bounds of a cluster
+When you receive an event from a cluster you can zoom to its bounds in one easy step.
+If all of the markers will appear at a higher zoom level, that zoom level is zoomed to instead.
+`zoomToBounds` takes an optional argument to pass [options to the resulting `fitBounds` call](http://leafletjs.com/reference.html#map-fitboundsoptions).
+
+See [marker-clustering-zoomtobounds.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
+```javascript
+markers.on('clusterclick', function (a) {
+ a.layer.zoomToBounds({padding: [20, 20]});
+});
+```
+
+#### Other clusters methods
+* **getChildCount**: Returns the total number of markers contained within that cluster.
+* **getAllChildMarkers(storage: array | undefined, ignoreDraggedMarker: boolean | undefined)**: Returns an array of all markers contained within this cluster (storage will be used if provided). If ignoreDraggedMarker is true and there is currently a marker dragged, the dragged marker will not be included in the array.
+* **spiderfy**: Spiderfies the child markers of this cluster
+* **unspiderfy**: Unspiderfies a cluster (opposite of spiderfy)
+
+## Handling LOTS of markers
+The Clusterer can handle 10,000 or even 50,000 markers (in chrome). IE9 has some issues with 50,000.
+- [realworld 10,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.10000.html)
+- [realworld 50,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html)
+
+Note: these two examples use the `chunkedLoading` option set to true in order to avoid locking the browser for a long time.
+
+## License
+
+Leaflet.markercluster is free software, and may be redistributed under the MIT-LICENSE.
+
+[](https://travis-ci.org/Leaflet/Leaflet.markercluster)
+
+## Sub-plugins
+Leaflet.markercluster plugin is very popular and as such it generates high and
+diverse expectations for increased functionalities.
+
+If you are in that case, be sure to have a look first at the repository
+[issues](https://github.com/Leaflet/Leaflet.markercluster/issues) in case what
+you are looking for would already be discussed, and some workarounds would be proposed.
+
+Check also the below sub-plugins:
+
+| Plugin | Description | Maintainer |
+| :----- | :---------- | :--------- |
+| [Leaflet.FeatureGroup.SubGroup](https://github.com/ghybs/Leaflet.FeatureGroup.SubGroup) | Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through L.Control.Layers). Typical usage is to dynamically add/remove groups of markers from Marker Cluster. | [ghybs](https://github.com/ghybs) |
+| [Leaflet.MarkerCluster.LayerSupport](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport) | Brings compatibility with L.Control.Layers and other Leaflet plugins. I.e. everything that uses direct calls to map.addLayer and map.removeLayer. | [ghybs](https://github.com/ghybs) |
+| [Leaflet.MarkerCluster.Freezable](https://github.com/ghybs/Leaflet.MarkerCluster.Freezable) | Adds the ability to freeze clusters at a specified zoom. E.g. freezing at maxZoom + 1 makes as if clustering was programmatically disabled. | [ghybs](https://github.com/ghybs) |
+| [Leaflet.MarkerCluster.PlacementStrategies](https://github.com/adammertel/Leaflet.MarkerCluster.PlacementStrategies) | Implements new strategies to position clustered markers (eg: clock, concentric circles, ...). Recommended to use with circleMarkers. [Demo](https://adammertel.github.io/Leaflet.MarkerCluster.PlacementStrategies/demo/demo1.html) | [adammertel](https://github.com/adammertel) / [UNIVIE](http://carto.univie.ac.at/) |
+| [Leaflet.MarkerCluster.List](https://github.com/adammertel/Leaflet.MarkerCluster.List) | Displays child elements in a list. Suitable for mobile devices. [Demo](https://adammertel.github.io/Leaflet.MarkerCluster.List/demo/demo1.html) | [adammertel](https://github.com/adammertel) / [UNIVIE](http://carto.univie.ac.at/) |
diff --git a/node_modules/leaflet.markercluster/bower.json b/node_modules/leaflet.markercluster/bower.json
new file mode 100644
index 0000000000000000000000000000000000000000..c797f7a52f1c5139ccfe6a1e5b9df16e077f89cc
--- /dev/null
+++ b/node_modules/leaflet.markercluster/bower.json
@@ -0,0 +1,27 @@
+{
+ "name": "leaflet.markercluster",
+ "version": "1.4.1",
+ "homepage": "https://github.com/Leaflet/Leaflet.markercluster",
+ "authors": [
+ "Dave Leaver "
+ ],
+ "description": "Marker Clustering plugin for Leaflet.",
+ "main": [
+ "dist/leaflet.markercluster-src.js",
+ "dist/MarkerCluster.css",
+ "dist/MarkerCluster.Default.css"
+ ],
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "example",
+ "spec",
+ "test",
+ "tests"
+ ],
+ "dependencies": {
+ "leaflet": ">= 1.3.1"
+ }
+}
\ No newline at end of file
diff --git a/node_modules/leaflet.markercluster/build/hintrc.js b/node_modules/leaflet.markercluster/build/hintrc.js
new file mode 100644
index 0000000000000000000000000000000000000000..55bfb369501a2493acc6f0d2c28aa5da2966ead5
--- /dev/null
+++ b/node_modules/leaflet.markercluster/build/hintrc.js
@@ -0,0 +1,37 @@
+exports.config = {
+
+ // environment
+ "browser": true,
+ "node": true,
+ "predef": ['L', 'define'],
+ "strict": false,
+
+ // code style
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "forin": false,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "undef": true,
+ "unused": true,
+ //"quotmark": "single",
+
+ // whitespace
+ "indent": 4,
+ "trailing": true,
+ "white": true,
+ "smarttabs": true,
+ //"maxlen": 120
+
+ // code simplicity - not enforced but nice to check from time to time
+ // "maxstatements": 20,
+ // "maxcomplexity": 5
+ // "maxparams": 4,
+ // "maxdepth": 4
+};
diff --git a/node_modules/leaflet.markercluster/build/rollup-config.js b/node_modules/leaflet.markercluster/build/rollup-config.js
new file mode 100644
index 0000000000000000000000000000000000000000..4c4f8fd861f4a588ad8f33602c6c76ff75cf1ddc
--- /dev/null
+++ b/node_modules/leaflet.markercluster/build/rollup-config.js
@@ -0,0 +1,43 @@
+
+// Config file for running Rollup in "normal" mode (non-watch)
+
+import rollupGitVersion from 'rollup-plugin-git-version'
+import json from 'rollup-plugin-json'
+
+import gitRev from 'git-rev-sync'
+
+
+let version = require('../package.json').version;
+let release;
+
+// Skip the git branch+rev in the banner when doing a release build
+if (process.env.NODE_ENV === 'release') {
+ release = true;
+} else {
+ release = false;
+ const branch = gitRev.branch();
+ const rev = gitRev.short();
+ version += '+' + branch + '.' + rev;
+}
+
+const banner = `/*
+ * Leaflet.markercluster ` + version + `,
+ * Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
+ * https://github.com/Leaflet/Leaflet.markercluster
+ * (c) 2012-2017, Dave Leaver, smartrak
+ */`;
+
+export default {
+ input: 'src/index.js',
+ output: {
+ banner,
+ file: 'dist/leaflet.markercluster-src.js',
+ format: 'umd',
+ legacy: true, // Needed to create files loadable by IE8
+ name: 'Leaflet.markercluster',
+ sourcemap: true,
+ },
+ plugins: [
+ release ? json() : rollupGitVersion(),
+ ],
+};
diff --git a/node_modules/leaflet.markercluster/example/geojson-sample.js b/node_modules/leaflet.markercluster/example/geojson-sample.js
new file mode 100644
index 0000000000000000000000000000000000000000..37a22665eb4a925768d1d7947ce69dc4deb0b9e2
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/geojson-sample.js
@@ -0,0 +1,53 @@
+var geojsonSample = {
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Point",
+ "coordinates": [102.0, 0.5]
+ },
+ "properties": {
+ "prop0": "value0",
+ "color": "blue"
+ }
+ },
+
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "LineString",
+ "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]
+ },
+ "properties": {
+ "color": "red",
+ "prop1": 0.0
+ }
+ },
+
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]
+ },
+ "properties": {
+ "color": "green",
+ "prop1": {
+ "this": "that"
+ }
+ }
+ },
+
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "MultiPolygon",
+ "coordinates": [[[[100.0, 1.5], [100.5, 1.5], [100.5, 2.0], [100.0, 2.0], [100.0, 1.5]]], [[[100.5, 2.0], [100.5, 2.5], [101.0, 2.5], [101.0, 2.0], [100.5, 2.0]]]]
+ },
+ "properties": {
+ "color": "purple"
+ }
+ }
+ ]
+};
diff --git a/node_modules/leaflet.markercluster/example/geojson.html b/node_modules/leaflet.markercluster/example/geojson.html
new file mode 100644
index 0000000000000000000000000000000000000000..3b6cd6277be55c9c06dc22212e8320ae58f36d03
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/geojson.html
@@ -0,0 +1,54 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/map.png b/node_modules/leaflet.markercluster/example/map.png
new file mode 100644
index 0000000000000000000000000000000000000000..fe06da6298bae62a0220d7808018d69e894f972e
Binary files /dev/null and b/node_modules/leaflet.markercluster/example/map.png differ
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-convexhull.html b/node_modules/leaflet.markercluster/example/marker-clustering-convexhull.html
new file mode 100644
index 0000000000000000000000000000000000000000..6a396ce73a42788a77b81919a58c7561ff7967d8
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-convexhull.html
@@ -0,0 +1,81 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-custom.html b/node_modules/leaflet.markercluster/example/marker-clustering-custom.html
new file mode 100644
index 0000000000000000000000000000000000000000..e50f09a118b586842119e2ba8dfa2ddec57d79ed
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-custom.html
@@ -0,0 +1,114 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-dragging.html b/node_modules/leaflet.markercluster/example/marker-clustering-dragging.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c060fff0b15179ccf5d85c90f6c799bd1b8cbf4
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-dragging.html
@@ -0,0 +1,83 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-everything.html b/node_modules/leaflet.markercluster/example/marker-clustering-everything.html
new file mode 100644
index 0000000000000000000000000000000000000000..3127fcf328bca06483d4c5e9f534b622289ced16
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-everything.html
@@ -0,0 +1,80 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-geojson.html b/node_modules/leaflet.markercluster/example/marker-clustering-geojson.html
new file mode 100644
index 0000000000000000000000000000000000000000..be8b4d5ee75a1a6d5343509f65c4ec085b03fb99
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-geojson.html
@@ -0,0 +1,70 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-pane.html b/node_modules/leaflet.markercluster/example/marker-clustering-pane.html
new file mode 100644
index 0000000000000000000000000000000000000000..343ca11b75268c64e2c6708374d1442b7bd48c7d
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-pane.html
@@ -0,0 +1,104 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html b/node_modules/leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html
new file mode 100644
index 0000000000000000000000000000000000000000..8789c493241b960dc619443b230e0fe5df7a3790
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html
@@ -0,0 +1,45 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Markers will show on the bottom 2 zoom levels even though the markers would normally cluster.
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-realworld-mobile.388.html b/node_modules/leaflet.markercluster/example/marker-clustering-realworld-mobile.388.html
new file mode 100644
index 0000000000000000000000000000000000000000..57dab1cb29b9266c28af611508b59cad80eb441e
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-realworld-mobile.388.html
@@ -0,0 +1,44 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-realworld.10000.html b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.10000.html
new file mode 100644
index 0000000000000000000000000000000000000000..d845a6e4c8c4c603d1a416d725278e2ab74e6394
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.10000.html
@@ -0,0 +1,46 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-realworld.388.html b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.388.html
new file mode 100644
index 0000000000000000000000000000000000000000..c745f488e21703ae512313191e30e24cb547efa0
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.388.html
@@ -0,0 +1,45 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-realworld.50000.html b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.50000.html
new file mode 100644
index 0000000000000000000000000000000000000000..362c4274479205a2a3094299c0e0633e77eb34f7
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-realworld.50000.html
@@ -0,0 +1,78 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-singlemarkermode.html b/node_modules/leaflet.markercluster/example/marker-clustering-singlemarkermode.html
new file mode 100644
index 0000000000000000000000000000000000000000..c5c8b602d2bcd9f8e1dd18b4b6b35628c9a4af2f
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-singlemarkermode.html
@@ -0,0 +1,60 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Click a cluster to zoom to its bounds
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-spiderfier.html b/node_modules/leaflet.markercluster/example/marker-clustering-spiderfier.html
new file mode 100644
index 0000000000000000000000000000000000000000..440b8ad3ab1025aad43db543096e76351e5e67d2
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-spiderfier.html
@@ -0,0 +1,60 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-zoomtobounds.html b/node_modules/leaflet.markercluster/example/marker-clustering-zoomtobounds.html
new file mode 100644
index 0000000000000000000000000000000000000000..0dc4c1dc3f89ed17db7321eff24dd13be3fe5bbe
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-zoomtobounds.html
@@ -0,0 +1,60 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Click a cluster to zoom to its bounds
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering-zoomtoshowlayer.html b/node_modules/leaflet.markercluster/example/marker-clustering-zoomtoshowlayer.html
new file mode 100644
index 0000000000000000000000000000000000000000..56a6ae394ad9f7c52425e1f128e3ed13ac5a3888
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering-zoomtoshowlayer.html
@@ -0,0 +1,59 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ When clicked we will zoom down to a marker, spiderfying if required to show it and then open its popup
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/marker-clustering.html b/node_modules/leaflet.markercluster/example/marker-clustering.html
new file mode 100644
index 0000000000000000000000000000000000000000..b41dbaae641336e3e7513f1ee6d17fd16b0fcdc5
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/marker-clustering.html
@@ -0,0 +1,88 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/mobile.css b/node_modules/leaflet.markercluster/example/mobile.css
new file mode 100644
index 0000000000000000000000000000000000000000..c59a527a6be58d3706208ea752e82d438ed163a2
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/mobile.css
@@ -0,0 +1,6 @@
+html, body, #map {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+}
\ No newline at end of file
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/add-1000-after.html b/node_modules/leaflet.markercluster/example/old-bugs/add-1000-after.html
new file mode 100644
index 0000000000000000000000000000000000000000..246f8e445208a2393ef4e5d9015fd42cf0b7884f
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/add-1000-after.html
@@ -0,0 +1,83 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #51. Click the button. It will add 1000 markers to the map. this should be fast, but previously in (non-IE browsers) it was very slow.
+ Bug #43. Improving performance more.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/add-markers-offscreen.html b/node_modules/leaflet.markercluster/example/old-bugs/add-markers-offscreen.html
new file mode 100644
index 0000000000000000000000000000000000000000..62568125d7fb86e2eb2b96b8f0dd3a6e88e8fe5f
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/add-markers-offscreen.html
@@ -0,0 +1,52 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #69. Click the button 2+ times. Zoom out. Should just be a single cluster but instead one of the child markers is still visible.
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/add-remove-before-addtomap.html b/node_modules/leaflet.markercluster/example/old-bugs/add-remove-before-addtomap.html
new file mode 100644
index 0000000000000000000000000000000000000000..d00c3544628ae4bedc259dc298149f1f3ce85cc4
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/add-remove-before-addtomap.html
@@ -0,0 +1,62 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #64. Nothing should appear on the map.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/animationless-zoom.html b/node_modules/leaflet.markercluster/example/old-bugs/animationless-zoom.html
new file mode 100644
index 0000000000000000000000000000000000000000..ddcc4355ed3b91d5562125644aab4ffdd417d16e
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/animationless-zoom.html
@@ -0,0 +1,47 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #216. Click the button. It will zoom in, leaflet will not do an animation for the zoom. A marker should be visible.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/click-cluster-at-screen-edge.html b/node_modules/leaflet.markercluster/example/old-bugs/click-cluster-at-screen-edge.html
new file mode 100644
index 0000000000000000000000000000000000000000..0ac40fb19f0d24a26e12ac871c19b074d462a592
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/click-cluster-at-screen-edge.html
@@ -0,0 +1,59 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #344. Click the cluster at the screen edge. Map will zoom to it and its markers will appear, but it will not disappear.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/disappearing-marker-from-spider.html b/node_modules/leaflet.markercluster/example/old-bugs/disappearing-marker-from-spider.html
new file mode 100644
index 0000000000000000000000000000000000000000..6197b2790c520d0d47b1172ccc30b93cffba0bea
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/disappearing-marker-from-spider.html
@@ -0,0 +1,106 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Click on the cluster to spiderfy and then
+
+
Note: The marker on the old cluster position comes back on next move or on map scrolling.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/doesnt-update-cluster-on-bottom-level.html b/node_modules/leaflet.markercluster/example/old-bugs/doesnt-update-cluster-on-bottom-level.html
new file mode 100644
index 0000000000000000000000000000000000000000..7ff060a943dcbaf9f99be00321bf751dbdc84a5d
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/doesnt-update-cluster-on-bottom-level.html
@@ -0,0 +1,69 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #114. Markers are added to the map periodically using addLayers. Bug was that after becoming a cluster (size 2 or 3 usually) they would never change again even if more markers were added to them.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/drag-with-spiderfying.html b/node_modules/leaflet.markercluster/example/old-bugs/drag-with-spiderfying.html
new file mode 100644
index 0000000000000000000000000000000000000000..e085b32ea15929a91a31e37daaf1a3753c6dcced
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/drag-with-spiderfying.html
@@ -0,0 +1,75 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bug #907. Drag a marker from a spiderfied cluster over other clusters.
+ Bug #808. Drag a marker and while dragging zoom out with scroll-wheel.
+
+
+
+
diff --git a/node_modules/leaflet.markercluster/example/old-bugs/remove-add-clustering.html b/node_modules/leaflet.markercluster/example/old-bugs/remove-add-clustering.html
new file mode 100644
index 0000000000000000000000000000000000000000..541cc785a5e3e625f1b315c87adaebaed096bde5
--- /dev/null
+++ b/node_modules/leaflet.markercluster/example/old-bugs/remove-add-clustering.html
@@ -0,0 +1,74 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Whenever a marker is clicked it is removed from the clusterer and added directly to the map instead.
+
Click Marker on Left, zoom out 1 layer, click marker on right.
+
Expected behaviour: Both markers are shown. Bugged behaviour: Both markers are on map with opacity 0.
', className: 'marker-cluster' + c, iconSize: new L.Point(40, 40) });
+ },
+
+ _bindEvents: function () {
+ var map = this._map,
+ spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
+ showCoverageOnHover = this.options.showCoverageOnHover,
+ zoomToBoundsOnClick = this.options.zoomToBoundsOnClick,
+ spiderfyOnEveryZoom = this.options.spiderfyOnEveryZoom;
+
+ //Zoom on cluster click or spiderfy if we are at the lowest level
+ if (spiderfyOnMaxZoom || zoomToBoundsOnClick || spiderfyOnEveryZoom) {
+ this.on('clusterclick clusterkeypress', this._zoomOrSpiderfy, this);
+ }
+
+ //Show convex hull (boundary) polygon on mouse over
+ if (showCoverageOnHover) {
+ this.on('clustermouseover', this._showCoverage, this);
+ this.on('clustermouseout', this._hideCoverage, this);
+ map.on('zoomend', this._hideCoverage, this);
+ }
+ },
+
+ _zoomOrSpiderfy: function (e) {
+ var cluster = e.layer,
+ bottomCluster = cluster;
+
+ if (e.type === 'clusterkeypress' && e.originalEvent && e.originalEvent.keyCode !== 13) {
+ return;
+ }
+
+ while (bottomCluster._childClusters.length === 1) {
+ bottomCluster = bottomCluster._childClusters[0];
+ }
+
+ if (bottomCluster._zoom === this._maxZoom &&
+ bottomCluster._childCount === cluster._childCount &&
+ this.options.spiderfyOnMaxZoom) {
+
+ // All child markers are contained in a single cluster from this._maxZoom to this cluster.
+ cluster.spiderfy();
+ } else if (this.options.zoomToBoundsOnClick) {
+ cluster.zoomToBounds();
+ }
+
+ if (this.options.spiderfyOnEveryZoom) {
+ cluster.spiderfy();
+ }
+
+ // Focus the map again for keyboard users.
+ if (e.originalEvent && e.originalEvent.keyCode === 13) {
+ this._map._container.focus();
+ }
+ },
+
+ _showCoverage: function (e) {
+ var map = this._map;
+ if (this._inZoomAnimation) {
+ return;
+ }
+ if (this._shownPolygon) {
+ map.removeLayer(this._shownPolygon);
+ }
+ if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) {
+ this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions);
+ map.addLayer(this._shownPolygon);
+ }
+ },
+
+ _hideCoverage: function () {
+ if (this._shownPolygon) {
+ this._map.removeLayer(this._shownPolygon);
+ this._shownPolygon = null;
+ }
+ },
+
+ _unbindEvents: function () {
+ var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
+ showCoverageOnHover = this.options.showCoverageOnHover,
+ zoomToBoundsOnClick = this.options.zoomToBoundsOnClick,
+ spiderfyOnEveryZoom = this.options.spiderfyOnEveryZoom,
+ map = this._map;
+
+ if (spiderfyOnMaxZoom || zoomToBoundsOnClick || spiderfyOnEveryZoom) {
+ this.off('clusterclick clusterkeypress', this._zoomOrSpiderfy, this);
+ }
+ if (showCoverageOnHover) {
+ this.off('clustermouseover', this._showCoverage, this);
+ this.off('clustermouseout', this._hideCoverage, this);
+ map.off('zoomend', this._hideCoverage, this);
+ }
+ },
+
+ _zoomEnd: function () {
+ if (!this._map) { //May have been removed from the map by a zoomEnd handler
+ return;
+ }
+ this._mergeSplitClusters();
+
+ this._zoom = Math.round(this._map._zoom);
+ this._currentShownBounds = this._getExpandedVisibleBounds();
+ },
+
+ _moveEnd: function () {
+ if (this._inZoomAnimation) {
+ return;
+ }
+
+ var newBounds = this._getExpandedVisibleBounds();
+
+ this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds);
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds);
+
+ this._currentShownBounds = newBounds;
+ return;
+ },
+
+ _generateInitialClusters: function () {
+ var maxZoom = Math.ceil(this._map.getMaxZoom()),
+ minZoom = Math.floor(this._map.getMinZoom()),
+ radius = this.options.maxClusterRadius,
+ radiusFn = radius;
+
+ //If we just set maxClusterRadius to a single number, we need to create
+ //a simple function to return that number. Otherwise, we just have to
+ //use the function we've passed in.
+ if (typeof radius !== "function") {
+ radiusFn = function () { return radius; };
+ }
+
+ if (this.options.disableClusteringAtZoom !== null) {
+ maxZoom = this.options.disableClusteringAtZoom - 1;
+ }
+ this._maxZoom = maxZoom;
+ this._gridClusters = {};
+ this._gridUnclustered = {};
+
+ //Set up DistanceGrids for each zoom
+ for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
+ this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
+ this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
+ }
+
+ // Instantiate the appropriate L.MarkerCluster class (animated or not).
+ this._topClusterLevel = new this._markerCluster(this, minZoom - 1);
+ },
+
+ //Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom)
+ _addLayer: function (layer, zoom) {
+ var gridClusters = this._gridClusters,
+ gridUnclustered = this._gridUnclustered,
+ minZoom = Math.floor(this._map.getMinZoom()),
+ markerPoint, z;
+
+ if (this.options.singleMarkerMode) {
+ this._overrideMarkerIcon(layer);
+ }
+
+ layer.on(this._childMarkerEventHandlers, this);
+
+ //Find the lowest zoom level to slot this one in
+ for (; zoom >= minZoom; zoom--) {
+ markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position
+
+ //Try find a cluster close by
+ var closest = gridClusters[zoom].getNearObject(markerPoint);
+ if (closest) {
+ closest._addChild(layer);
+ layer.__parent = closest;
+ return;
+ }
+
+ //Try find a marker close by to form a new cluster with
+ closest = gridUnclustered[zoom].getNearObject(markerPoint);
+ if (closest) {
+ var parent = closest.__parent;
+ if (parent) {
+ this._removeLayer(closest, false);
+ }
+
+ //Create new cluster with these 2 in it
+
+ var newCluster = new this._markerCluster(this, zoom, closest, layer);
+ gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom));
+ closest.__parent = newCluster;
+ layer.__parent = newCluster;
+
+ //First create any new intermediate parent clusters that don't exist
+ var lastParent = newCluster;
+ for (z = zoom - 1; z > parent._zoom; z--) {
+ lastParent = new this._markerCluster(this, z, lastParent);
+ gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z));
+ }
+ parent._addChild(lastParent);
+
+ //Remove closest from this zoom level and any above that it is in, replace with newCluster
+ this._removeFromGridUnclustered(closest, zoom);
+
+ return;
+ }
+
+ //Didn't manage to cluster in at this zoom, record us as a marker here and continue upwards
+ gridUnclustered[zoom].addObject(layer, markerPoint);
+ }
+
+ //Didn't get in anything, add us to the top
+ this._topClusterLevel._addChild(layer);
+ layer.__parent = this._topClusterLevel;
+ return;
+ },
+
+ /**
+ * Refreshes the icon of all "dirty" visible clusters.
+ * Non-visible "dirty" clusters will be updated when they are added to the map.
+ * @private
+ */
+ _refreshClustersIcons: function () {
+ this._featureGroup.eachLayer(function (c) {
+ if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
+ c._updateIcon();
+ }
+ });
+ },
+
+ //Enqueue code to fire after the marker expand/contract has happened
+ _enqueue: function (fn) {
+ this._queue.push(fn);
+ if (!this._queueTimeout) {
+ this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300);
+ }
+ },
+ _processQueue: function () {
+ for (var i = 0; i < this._queue.length; i++) {
+ this._queue[i].call(this);
+ }
+ this._queue.length = 0;
+ clearTimeout(this._queueTimeout);
+ this._queueTimeout = null;
+ },
+
+ //Merge and split any existing clusters that are too big or small
+ _mergeSplitClusters: function () {
+ var mapZoom = Math.round(this._map._zoom);
+
+ //In case we are starting to split before the animation finished
+ this._processQueue();
+
+ if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split
+ this._animationStart();
+ //Remove clusters now off screen
+ this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds());
+
+ this._animationZoomIn(this._zoom, mapZoom);
+
+ } else if (this._zoom > mapZoom) { //Zoom out, merge
+ this._animationStart();
+
+ this._animationZoomOut(this._zoom, mapZoom);
+ } else {
+ this._moveEnd();
+ }
+ },
+
+ //Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan)
+ _getExpandedVisibleBounds: function () {
+ if (!this.options.removeOutsideVisibleBounds) {
+ return this._mapBoundsInfinite;
+ } else if (L.Browser.mobile) {
+ return this._checkBoundsMaxLat(this._map.getBounds());
+ }
+
+ return this._checkBoundsMaxLat(this._map.getBounds().pad(1)); // Padding expands the bounds by its own dimensions but scaled with the given factor.
+ },
+
+ /**
+ * Expands the latitude to Infinity (or -Infinity) if the input bounds reach the map projection maximum defined latitude
+ * (in the case of Web/Spherical Mercator, it is 85.0511287798 / see https://en.wikipedia.org/wiki/Web_Mercator#Formulas).
+ * Otherwise, the removeOutsideVisibleBounds option will remove markers beyond that limit, whereas the same markers without
+ * this option (or outside MCG) will have their position floored (ceiled) by the projection and rendered at that limit,
+ * making the user think that MCG "eats" them and never displays them again.
+ * @param bounds L.LatLngBounds
+ * @returns {L.LatLngBounds}
+ * @private
+ */
+ _checkBoundsMaxLat: function (bounds) {
+ var maxLat = this._maxLat;
+
+ if (maxLat !== undefined) {
+ if (bounds.getNorth() >= maxLat) {
+ bounds._northEast.lat = Infinity;
+ }
+ if (bounds.getSouth() <= -maxLat) {
+ bounds._southWest.lat = -Infinity;
+ }
+ }
+
+ return bounds;
+ },
+
+ //Shared animation code
+ _animationAddLayerNonAnimated: function (layer, newCluster) {
+ if (newCluster === layer) {
+ this._featureGroup.addLayer(layer);
+ } else if (newCluster._childCount === 2) {
+ newCluster._addToMap();
+
+ var markers = newCluster.getAllChildMarkers();
+ this._featureGroup.removeLayer(markers[0]);
+ this._featureGroup.removeLayer(markers[1]);
+ } else {
+ newCluster._updateIcon();
+ }
+ },
+
+ /**
+ * Extracts individual (i.e. non-group) layers from a Layer Group.
+ * @param group to extract layers from.
+ * @param output {Array} in which to store the extracted layers.
+ * @returns {*|Array}
+ * @private
+ */
+ _extractNonGroupLayers: function (group, output) {
+ var layers = group.getLayers(),
+ i = 0,
+ layer;
+
+ output = output || [];
+
+ for (; i < layers.length; i++) {
+ layer = layers[i];
+
+ if (layer instanceof L.LayerGroup) {
+ this._extractNonGroupLayers(layer, output);
+ continue;
+ }
+
+ output.push(layer);
+ }
+
+ return output;
+ },
+
+ /**
+ * Implements the singleMarkerMode option.
+ * @param layer Marker to re-style using the Clusters iconCreateFunction.
+ * @returns {L.Icon} The newly created icon.
+ * @private
+ */
+ _overrideMarkerIcon: function (layer) {
+ var icon = layer.options.icon = this.options.iconCreateFunction({
+ getChildCount: function () {
+ return 1;
+ },
+ getAllChildMarkers: function () {
+ return [layer];
+ }
+ });
+
+ return icon;
+ }
+});
+
+// Constant bounds used in case option "removeOutsideVisibleBounds" is set to false.
+L.MarkerClusterGroup.include({
+ _mapBoundsInfinite: new L.LatLngBounds(new L.LatLng(-Infinity, -Infinity), new L.LatLng(Infinity, Infinity))
+});
+
+L.MarkerClusterGroup.include({
+ _noAnimation: {
+ //Non Animated versions of everything
+ _animationStart: function () {
+ //Do nothing...
+ },
+ _animationZoomIn: function (previousZoomLevel, newZoomLevel) {
+ this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
+
+ //We didn't actually animate, but we use this event to mean "clustering animations have finished"
+ this.fire('animationend');
+ },
+ _animationZoomOut: function (previousZoomLevel, newZoomLevel) {
+ this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
+
+ //We didn't actually animate, but we use this event to mean "clustering animations have finished"
+ this.fire('animationend');
+ },
+ _animationAddLayer: function (layer, newCluster) {
+ this._animationAddLayerNonAnimated(layer, newCluster);
+ }
+ },
+
+ _withAnimation: {
+ //Animated versions here
+ _animationStart: function () {
+ this._map._mapPane.className += ' leaflet-cluster-anim';
+ this._inZoomAnimation++;
+ },
+
+ _animationZoomIn: function (previousZoomLevel, newZoomLevel) {
+ var bounds = this._getExpandedVisibleBounds(),
+ fg = this._featureGroup,
+ minZoom = Math.floor(this._map.getMinZoom()),
+ i;
+
+ this._ignoreMove = true;
+
+ //Add all children of current clusters to map and remove those clusters from map
+ this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
+ var startPos = c._latlng,
+ markers = c._markers,
+ m;
+
+ if (!bounds.contains(startPos)) {
+ startPos = null;
+ }
+
+ if (c._isSingleParent() && previousZoomLevel + 1 === newZoomLevel) { //Immediately add the new child and remove us
+ fg.removeLayer(c);
+ c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds);
+ } else {
+ //Fade out old cluster
+ c.clusterHide();
+ c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds);
+ }
+
+ //Remove all markers that aren't visible any more
+ //TODO: Do we actually need to do this on the higher levels too?
+ for (i = markers.length - 1; i >= 0; i--) {
+ m = markers[i];
+ if (!bounds.contains(m._latlng)) {
+ fg.removeLayer(m);
+ }
+ }
+
+ });
+
+ this._forceLayout();
+
+ //Update opacities
+ this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
+ //TODO Maybe? Update markers in _recursivelyBecomeVisible
+ fg.eachLayer(function (n) {
+ if (!(n instanceof L.MarkerCluster) && n._icon) {
+ n.clusterShow();
+ }
+ });
+
+ //update the positions of the just added clusters/markers
+ this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
+ c._recursivelyRestoreChildPositions(newZoomLevel);
+ });
+
+ this._ignoreMove = false;
+
+ //Remove the old clusters and close the zoom animation
+ this._enqueue(function () {
+ //update the positions of the just added clusters/markers
+ this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
+ fg.removeLayer(c);
+ c.clusterShow();
+ });
+
+ this._animationEnd();
+ });
+ },
+
+ _animationZoomOut: function (previousZoomLevel, newZoomLevel) {
+ this._animationZoomOutSingle(this._topClusterLevel, previousZoomLevel - 1, newZoomLevel);
+
+ //Need to add markers for those that weren't on the map before but are now
+ this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
+ //Remove markers that were on the map before but won't be now
+ this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds());
+ },
+
+ _animationAddLayer: function (layer, newCluster) {
+ var me = this,
+ fg = this._featureGroup;
+
+ fg.addLayer(layer);
+ if (newCluster !== layer) {
+ if (newCluster._childCount > 2) { //Was already a cluster
+
+ newCluster._updateIcon();
+ this._forceLayout();
+ this._animationStart();
+
+ layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng()));
+ layer.clusterHide();
+
+ this._enqueue(function () {
+ fg.removeLayer(layer);
+ layer.clusterShow();
+
+ me._animationEnd();
+ });
+
+ } else { //Just became a cluster
+ this._forceLayout();
+
+ me._animationStart();
+ me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._zoom);
+ }
+ }
+ }
+ },
+
+ // Private methods for animated versions.
+ _animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) {
+ var bounds = this._getExpandedVisibleBounds(),
+ minZoom = Math.floor(this._map.getMinZoom());
+
+ //Animate all of the markers in the clusters to move to their cluster center point
+ cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel);
+
+ var me = this;
+
+ //Update the opacity (If we immediately set it they won't animate)
+ this._forceLayout();
+ cluster._recursivelyBecomeVisible(bounds, newZoomLevel);
+
+ //TODO: Maybe use the transition timing stuff to make this more reliable
+ //When the animations are done, tidy up
+ this._enqueue(function () {
+
+ //This cluster stopped being a cluster before the timeout fired
+ if (cluster._childCount === 1) {
+ var m = cluster._markers[0];
+ //If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it
+ this._ignoreMove = true;
+ m.setLatLng(m.getLatLng());
+ this._ignoreMove = false;
+ if (m.clusterShow) {
+ m.clusterShow();
+ }
+ } else {
+ cluster._recursively(bounds, newZoomLevel, minZoom, function (c) {
+ c._recursivelyRemoveChildrenFromMap(bounds, minZoom, previousZoomLevel + 1);
+ });
+ }
+ me._animationEnd();
+ });
+ },
+
+ _animationEnd: function () {
+ if (this._map) {
+ this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
+ }
+ this._inZoomAnimation--;
+ this.fire('animationend');
+ },
+
+ //Force a browser layout of stuff in the map
+ // Should apply the current opacity and location to all elements so we can update them again for an animation
+ _forceLayout: function () {
+ //In my testing this works, infact offsetWidth of any element seems to work.
+ //Could loop all this._layers and do this for each _icon if it stops working
+
+ L.Util.falseFn(document.body.offsetWidth);
+ }
+});
+
+L.markerClusterGroup = function (options) {
+ return new L.MarkerClusterGroup(options);
+};
diff --git a/node_modules/leaflet.markercluster/src/MarkerOpacity.js b/node_modules/leaflet.markercluster/src/MarkerOpacity.js
new file mode 100644
index 0000000000000000000000000000000000000000..e8b0bb6f4ce89d8e526ca549be064b2a23843a9d
--- /dev/null
+++ b/node_modules/leaflet.markercluster/src/MarkerOpacity.js
@@ -0,0 +1,22 @@
+/*
+* Extends L.Marker to include two extra methods: clusterHide and clusterShow.
+*
+* They work as setOpacity(0) and setOpacity(1) respectively, but
+* don't overwrite the options.opacity
+*
+*/
+
+L.Marker.include({
+ clusterHide: function () {
+ var backup = this.options.opacity;
+ this.setOpacity(0);
+ this.options.opacity = backup;
+ return this;
+ },
+
+ clusterShow: function () {
+ return this.setOpacity(this.options.opacity);
+ }
+});
+
+
diff --git a/node_modules/leaflet.markercluster/src/index.js b/node_modules/leaflet.markercluster/src/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..80f1b15937a50ef8c07862e41582a346700730a2
--- /dev/null
+++ b/node_modules/leaflet.markercluster/src/index.js
@@ -0,0 +1,8 @@
+
+export { MarkerClusterGroup } from './MarkerClusterGroup.js';
+export { MarkerCluster } from './MarkerCluster.js';
+import {} from './MarkerOpacity.js';
+import {} from './DistanceGrid.js';
+import {} from './MarkerCluster.QuickHull.js';
+import {} from './MarkerCluster.Spiderfier.js';
+import {} from './MarkerClusterGroup.Refresh.js';
diff --git a/node_modules/leaflet/src/layer/vector/Polygon.js b/node_modules/leaflet/src/layer/vector/Polygon.js
new file mode 100644
index 0000000000000000000000000000000000000000..3c4bf04ace32f9eb6caf47980e83f15f6ad318b7
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/Polygon.js
@@ -0,0 +1,159 @@
+import {Polyline} from './Polyline';
+import {LatLng} from '../../geo/LatLng';
+import * as LineUtil from '../../geometry/LineUtil';
+import {Point} from '../../geometry/Point';
+import {Bounds} from '../../geometry/Bounds';
+import * as PolyUtil from '../../geometry/PolyUtil';
+
+/*
+ * @class Polygon
+ * @aka L.Polygon
+ * @inherits Polyline
+ *
+ * A class for drawing polygon overlays on a map. Extends `Polyline`.
+ *
+ * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
+ *
+ *
+ * @example
+ *
+ * ```js
+ * // create a red polygon from an array of LatLng points
+ * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
+ *
+ * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
+ *
+ * // zoom the map to the polygon
+ * map.fitBounds(polygon.getBounds());
+ * ```
+ *
+ * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
+ *
+ * ```js
+ * var latlngs = [
+ * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+ * ];
+ * ```
+ *
+ * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
+ *
+ * ```js
+ * var latlngs = [
+ * [ // first polygon
+ * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+ * ],
+ * [ // second polygon
+ * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
+ * ]
+ * ];
+ * ```
+ */
+
+export var Polygon = Polyline.extend({
+
+ options: {
+ fill: true
+ },
+
+ isEmpty: function () {
+ return !this._latlngs.length || !this._latlngs[0].length;
+ },
+
+ // @method getCenter(): LatLng
+ // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the Polygon.
+ getCenter: function () {
+ // throws error when not yet added to map as this center calculation requires projected coordinates
+ if (!this._map) {
+ throw new Error('Must add layer to map before using getCenter()');
+ }
+ return PolyUtil.polygonCenter(this._defaultShape(), this._map.options.crs);
+ },
+
+ _convertLatLngs: function (latlngs) {
+ var result = Polyline.prototype._convertLatLngs.call(this, latlngs),
+ len = result.length;
+
+ // remove last point if it equals first one
+ if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {
+ result.pop();
+ }
+ return result;
+ },
+
+ _setLatLngs: function (latlngs) {
+ Polyline.prototype._setLatLngs.call(this, latlngs);
+ if (LineUtil.isFlat(this._latlngs)) {
+ this._latlngs = [this._latlngs];
+ }
+ },
+
+ _defaultShape: function () {
+ return LineUtil.isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
+ },
+
+ _clipPoints: function () {
+ // polygons need a different clipping algorithm so we redefine that
+
+ var bounds = this._renderer._bounds,
+ w = this.options.weight,
+ p = new Point(w, w);
+
+ // increase clip padding by stroke width to avoid stroke on clip edges
+ bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));
+
+ this._parts = [];
+ if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
+ return;
+ }
+
+ if (this.options.noClip) {
+ this._parts = this._rings;
+ return;
+ }
+
+ for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
+ clipped = PolyUtil.clipPolygon(this._rings[i], bounds, true);
+ if (clipped.length) {
+ this._parts.push(clipped);
+ }
+ }
+ },
+
+ _updatePath: function () {
+ this._renderer._updatePoly(this, true);
+ },
+
+ // Needed by the `Canvas` renderer for interactivity
+ _containsPoint: function (p) {
+ var inside = false,
+ part, p1, p2, i, j, k, len, len2;
+
+ if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
+
+ // ray casting algorithm for detecting if point is in polygon
+ for (i = 0, len = this._parts.length; i < len; i++) {
+ part = this._parts[i];
+
+ for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
+ p1 = part[j];
+ p2 = part[k];
+
+ if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {
+ inside = !inside;
+ }
+ }
+ }
+
+ // also check if it's on polygon stroke
+ return inside || Polyline.prototype._containsPoint.call(this, p, true);
+ }
+
+});
+
+
+// @factory L.polygon(latlngs: LatLng[], options?: Polyline options)
+export function polygon(latlngs, options) {
+ return new Polygon(latlngs, options);
+}
diff --git a/node_modules/leaflet/src/layer/vector/Polyline.js b/node_modules/leaflet/src/layer/vector/Polyline.js
new file mode 100644
index 0000000000000000000000000000000000000000..0d5a3d3b7d99ab883b0036df15e74690ceee8eb6
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/Polyline.js
@@ -0,0 +1,307 @@
+import {Path} from './Path';
+import * as Util from '../../core/Util';
+import * as LineUtil from '../../geometry/LineUtil';
+import {LatLng, toLatLng} from '../../geo/LatLng';
+import {LatLngBounds} from '../../geo/LatLngBounds';
+import {Bounds} from '../../geometry/Bounds';
+import {Point} from '../../geometry/Point';
+
+/*
+ * @class Polyline
+ * @aka L.Polyline
+ * @inherits Path
+ *
+ * A class for drawing polyline overlays on a map. Extends `Path`.
+ *
+ * @example
+ *
+ * ```js
+ * // create a red polyline from an array of LatLng points
+ * var latlngs = [
+ * [45.51, -122.68],
+ * [37.77, -122.43],
+ * [34.04, -118.2]
+ * ];
+ *
+ * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
+ *
+ * // zoom the map to the polyline
+ * map.fitBounds(polyline.getBounds());
+ * ```
+ *
+ * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:
+ *
+ * ```js
+ * // create a red polyline from an array of arrays of LatLng points
+ * var latlngs = [
+ * [[45.51, -122.68],
+ * [37.77, -122.43],
+ * [34.04, -118.2]],
+ * [[40.78, -73.91],
+ * [41.83, -87.62],
+ * [32.76, -96.72]]
+ * ];
+ * ```
+ */
+
+
+export var Polyline = Path.extend({
+
+ // @section
+ // @aka Polyline options
+ options: {
+ // @option smoothFactor: Number = 1.0
+ // How much to simplify the polyline on each zoom level. More means
+ // better performance and smoother look, and less means more accurate representation.
+ smoothFactor: 1.0,
+
+ // @option noClip: Boolean = false
+ // Disable polyline clipping.
+ noClip: false
+ },
+
+ initialize: function (latlngs, options) {
+ Util.setOptions(this, options);
+ this._setLatLngs(latlngs);
+ },
+
+ // @method getLatLngs(): LatLng[]
+ // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+ getLatLngs: function () {
+ return this._latlngs;
+ },
+
+ // @method setLatLngs(latlngs: LatLng[]): this
+ // Replaces all the points in the polyline with the given array of geographical points.
+ setLatLngs: function (latlngs) {
+ this._setLatLngs(latlngs);
+ return this.redraw();
+ },
+
+ // @method isEmpty(): Boolean
+ // Returns `true` if the Polyline has no LatLngs.
+ isEmpty: function () {
+ return !this._latlngs.length;
+ },
+
+ // @method closestLayerPoint(p: Point): Point
+ // Returns the point closest to `p` on the Polyline.
+ closestLayerPoint: function (p) {
+ var minDistance = Infinity,
+ minPoint = null,
+ closest = LineUtil._sqClosestPointOnSegment,
+ p1, p2;
+
+ for (var j = 0, jLen = this._parts.length; j < jLen; j++) {
+ var points = this._parts[j];
+
+ for (var i = 1, len = points.length; i < len; i++) {
+ p1 = points[i - 1];
+ p2 = points[i];
+
+ var sqDist = closest(p, p1, p2, true);
+
+ if (sqDist < minDistance) {
+ minDistance = sqDist;
+ minPoint = closest(p, p1, p2);
+ }
+ }
+ }
+ if (minPoint) {
+ minPoint.distance = Math.sqrt(minDistance);
+ }
+ return minPoint;
+ },
+
+ // @method getCenter(): LatLng
+ // Returns the center ([centroid](https://en.wikipedia.org/wiki/Centroid)) of the polyline.
+ getCenter: function () {
+ // throws error when not yet added to map as this center calculation requires projected coordinates
+ if (!this._map) {
+ throw new Error('Must add layer to map before using getCenter()');
+ }
+ return LineUtil.polylineCenter(this._defaultShape(), this._map.options.crs);
+ },
+
+ // @method getBounds(): LatLngBounds
+ // Returns the `LatLngBounds` of the path.
+ getBounds: function () {
+ return this._bounds;
+ },
+
+ // @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this
+ // Adds a given point to the polyline. By default, adds to the first ring of
+ // the polyline in case of a multi-polyline, but can be overridden by passing
+ // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).
+ addLatLng: function (latlng, latlngs) {
+ latlngs = latlngs || this._defaultShape();
+ latlng = toLatLng(latlng);
+ latlngs.push(latlng);
+ this._bounds.extend(latlng);
+ return this.redraw();
+ },
+
+ _setLatLngs: function (latlngs) {
+ this._bounds = new LatLngBounds();
+ this._latlngs = this._convertLatLngs(latlngs);
+ },
+
+ _defaultShape: function () {
+ return LineUtil.isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];
+ },
+
+ // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
+ _convertLatLngs: function (latlngs) {
+ var result = [],
+ flat = LineUtil.isFlat(latlngs);
+
+ for (var i = 0, len = latlngs.length; i < len; i++) {
+ if (flat) {
+ result[i] = toLatLng(latlngs[i]);
+ this._bounds.extend(result[i]);
+ } else {
+ result[i] = this._convertLatLngs(latlngs[i]);
+ }
+ }
+
+ return result;
+ },
+
+ _project: function () {
+ var pxBounds = new Bounds();
+ this._rings = [];
+ this._projectLatlngs(this._latlngs, this._rings, pxBounds);
+
+ if (this._bounds.isValid() && pxBounds.isValid()) {
+ this._rawPxBounds = pxBounds;
+ this._updateBounds();
+ }
+ },
+
+ _updateBounds: function () {
+ var w = this._clickTolerance(),
+ p = new Point(w, w);
+
+ if (!this._rawPxBounds) {
+ return;
+ }
+
+ this._pxBounds = new Bounds([
+ this._rawPxBounds.min.subtract(p),
+ this._rawPxBounds.max.add(p)
+ ]);
+ },
+
+ // recursively turns latlngs into a set of rings with projected coordinates
+ _projectLatlngs: function (latlngs, result, projectedBounds) {
+ var flat = latlngs[0] instanceof LatLng,
+ len = latlngs.length,
+ i, ring;
+
+ if (flat) {
+ ring = [];
+ for (i = 0; i < len; i++) {
+ ring[i] = this._map.latLngToLayerPoint(latlngs[i]);
+ projectedBounds.extend(ring[i]);
+ }
+ result.push(ring);
+ } else {
+ for (i = 0; i < len; i++) {
+ this._projectLatlngs(latlngs[i], result, projectedBounds);
+ }
+ }
+ },
+
+ // clip polyline by renderer bounds so that we have less to render for performance
+ _clipPoints: function () {
+ var bounds = this._renderer._bounds;
+
+ this._parts = [];
+ if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
+ return;
+ }
+
+ if (this.options.noClip) {
+ this._parts = this._rings;
+ return;
+ }
+
+ var parts = this._parts,
+ i, j, k, len, len2, segment, points;
+
+ for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
+ points = this._rings[i];
+
+ for (j = 0, len2 = points.length; j < len2 - 1; j++) {
+ segment = LineUtil.clipSegment(points[j], points[j + 1], bounds, j, true);
+
+ if (!segment) { continue; }
+
+ parts[k] = parts[k] || [];
+ parts[k].push(segment[0]);
+
+ // if segment goes out of screen, or it's the last one, it's the end of the line part
+ if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
+ parts[k].push(segment[1]);
+ k++;
+ }
+ }
+ }
+ },
+
+ // simplify each clipped part of the polyline for performance
+ _simplifyPoints: function () {
+ var parts = this._parts,
+ tolerance = this.options.smoothFactor;
+
+ for (var i = 0, len = parts.length; i < len; i++) {
+ parts[i] = LineUtil.simplify(parts[i], tolerance);
+ }
+ },
+
+ _update: function () {
+ if (!this._map) { return; }
+
+ this._clipPoints();
+ this._simplifyPoints();
+ this._updatePath();
+ },
+
+ _updatePath: function () {
+ this._renderer._updatePoly(this);
+ },
+
+ // Needed by the `Canvas` renderer for interactivity
+ _containsPoint: function (p, closed) {
+ var i, j, k, len, len2, part,
+ w = this._clickTolerance();
+
+ if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
+
+ // hit detection for polylines
+ for (i = 0, len = this._parts.length; i < len; i++) {
+ part = this._parts[i];
+
+ for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
+ if (!closed && (j === 0)) { continue; }
+
+ if (LineUtil.pointToSegmentDistance(p, part[k], part[j]) <= w) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+});
+
+// @factory L.polyline(latlngs: LatLng[], options?: Polyline options)
+// Instantiates a polyline object given an array of geographical points and
+// optionally an options object. You can create a `Polyline` object with
+// multiple separate lines (`MultiPolyline`) by passing an array of arrays
+// of geographic points.
+export function polyline(latlngs, options) {
+ return new Polyline(latlngs, options);
+}
+
+// Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.
+Polyline._flat = LineUtil._flat;
diff --git a/node_modules/leaflet/src/layer/vector/Rectangle.js b/node_modules/leaflet/src/layer/vector/Rectangle.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceec041bd97c55d4ef7ddf5952e4b62062c0471a
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/Rectangle.js
@@ -0,0 +1,57 @@
+import {Polygon} from './Polygon';
+import {toLatLngBounds} from '../../geo/LatLngBounds';
+
+/*
+ * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.
+ */
+
+/*
+ * @class Rectangle
+ * @aka L.Rectangle
+ * @inherits Polygon
+ *
+ * A class for drawing rectangle overlays on a map. Extends `Polygon`.
+ *
+ * @example
+ *
+ * ```js
+ * // define rectangle geographical bounds
+ * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
+ *
+ * // create an orange rectangle
+ * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
+ *
+ * // zoom the map to the rectangle bounds
+ * map.fitBounds(bounds);
+ * ```
+ *
+ */
+
+
+export var Rectangle = Polygon.extend({
+ initialize: function (latLngBounds, options) {
+ Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);
+ },
+
+ // @method setBounds(latLngBounds: LatLngBounds): this
+ // Redraws the rectangle with the passed bounds.
+ setBounds: function (latLngBounds) {
+ return this.setLatLngs(this._boundsToLatLngs(latLngBounds));
+ },
+
+ _boundsToLatLngs: function (latLngBounds) {
+ latLngBounds = toLatLngBounds(latLngBounds);
+ return [
+ latLngBounds.getSouthWest(),
+ latLngBounds.getNorthWest(),
+ latLngBounds.getNorthEast(),
+ latLngBounds.getSouthEast()
+ ];
+ }
+});
+
+
+// @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options)
+export function rectangle(latLngBounds, options) {
+ return new Rectangle(latLngBounds, options);
+}
diff --git a/node_modules/leaflet/src/layer/vector/Renderer.getRenderer.js b/node_modules/leaflet/src/layer/vector/Renderer.getRenderer.js
new file mode 100644
index 0000000000000000000000000000000000000000..b25f70e3108c450614658842d2e1c414d76c86fa
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/Renderer.getRenderer.js
@@ -0,0 +1,45 @@
+import {Map} from '../../map/Map';
+import {canvas} from './Canvas';
+import {svg} from './SVG';
+
+Map.include({
+ // @namespace Map; @method getRenderer(layer: Path): Renderer
+ // Returns the instance of `Renderer` that should be used to render the given
+ // `Path`. It will ensure that the `renderer` options of the map and paths
+ // are respected, and that the renderers do exist on the map.
+ getRenderer: function (layer) {
+ // @namespace Path; @option renderer: Renderer
+ // Use this specific instance of `Renderer` for this path. Takes
+ // precedence over the map's [default renderer](#map-renderer).
+ var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer;
+
+ if (!renderer) {
+ renderer = this._renderer = this._createRenderer();
+ }
+
+ if (!this.hasLayer(renderer)) {
+ this.addLayer(renderer);
+ }
+ return renderer;
+ },
+
+ _getPaneRenderer: function (name) {
+ if (name === 'overlayPane' || name === undefined) {
+ return false;
+ }
+
+ var renderer = this._paneRenderers[name];
+ if (renderer === undefined) {
+ renderer = this._createRenderer({pane: name});
+ this._paneRenderers[name] = renderer;
+ }
+ return renderer;
+ },
+
+ _createRenderer: function (options) {
+ // @namespace Map; @option preferCanvas: Boolean = false
+ // Whether `Path`s should be rendered on a `Canvas` renderer.
+ // By default, all `Path`s are rendered in a `SVG` renderer.
+ return (this.options.preferCanvas && canvas(options)) || svg(options);
+ }
+});
diff --git a/node_modules/leaflet/src/layer/vector/Renderer.js b/node_modules/leaflet/src/layer/vector/Renderer.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7fcee2a0b06a82bf16fa8d6410ee250c35ead76
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/Renderer.js
@@ -0,0 +1,133 @@
+import {Layer} from '../Layer';
+import * as DomUtil from '../../dom/DomUtil';
+import * as Util from '../../core/Util';
+import Browser from '../../core/Browser';
+import {Bounds} from '../../geometry/Bounds';
+
+
+
+/*
+ * @class Renderer
+ * @inherits Layer
+ * @aka L.Renderer
+ *
+ * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the
+ * DOM container of the renderer, its bounds, and its zoom animation.
+ *
+ * A `Renderer` works as an implicit layer group for all `Path`s - the renderer
+ * itself can be added or removed to the map. All paths use a renderer, which can
+ * be implicit (the map will decide the type of renderer and use it automatically)
+ * or explicit (using the [`renderer`](#path-renderer) option of the path).
+ *
+ * Do not use this class directly, use `SVG` and `Canvas` instead.
+ *
+ * @event update: Event
+ * Fired when the renderer updates its bounds, center and zoom, for example when
+ * its map has moved
+ */
+
+export var Renderer = Layer.extend({
+
+ // @section
+ // @aka Renderer options
+ options: {
+ // @option padding: Number = 0.1
+ // How much to extend the clip area around the map view (relative to its size)
+ // e.g. 0.1 would be 10% of map view in each direction
+ padding: 0.1
+ },
+
+ initialize: function (options) {
+ Util.setOptions(this, options);
+ Util.stamp(this);
+ this._layers = this._layers || {};
+ },
+
+ onAdd: function () {
+ if (!this._container) {
+ this._initContainer(); // defined by renderer implementations
+
+ // always keep transform-origin as 0 0
+ DomUtil.addClass(this._container, 'leaflet-zoom-animated');
+ }
+
+ this.getPane().appendChild(this._container);
+ this._update();
+ this.on('update', this._updatePaths, this);
+ },
+
+ onRemove: function () {
+ this.off('update', this._updatePaths, this);
+ this._destroyContainer();
+ },
+
+ getEvents: function () {
+ var events = {
+ viewreset: this._reset,
+ zoom: this._onZoom,
+ moveend: this._update,
+ zoomend: this._onZoomEnd
+ };
+ if (this._zoomAnimated) {
+ events.zoomanim = this._onAnimZoom;
+ }
+ return events;
+ },
+
+ _onAnimZoom: function (ev) {
+ this._updateTransform(ev.center, ev.zoom);
+ },
+
+ _onZoom: function () {
+ this._updateTransform(this._map.getCenter(), this._map.getZoom());
+ },
+
+ _updateTransform: function (center, zoom) {
+ var scale = this._map.getZoomScale(zoom, this._zoom),
+ viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding),
+ currentCenterPoint = this._map.project(this._center, zoom),
+
+ topLeftOffset = viewHalf.multiplyBy(-scale).add(currentCenterPoint)
+ .subtract(this._map._getNewPixelOrigin(center, zoom));
+
+ if (Browser.any3d) {
+ DomUtil.setTransform(this._container, topLeftOffset, scale);
+ } else {
+ DomUtil.setPosition(this._container, topLeftOffset);
+ }
+ },
+
+ _reset: function () {
+ this._update();
+ this._updateTransform(this._center, this._zoom);
+
+ for (var id in this._layers) {
+ this._layers[id]._reset();
+ }
+ },
+
+ _onZoomEnd: function () {
+ for (var id in this._layers) {
+ this._layers[id]._project();
+ }
+ },
+
+ _updatePaths: function () {
+ for (var id in this._layers) {
+ this._layers[id]._update();
+ }
+ },
+
+ _update: function () {
+ // Update pixel bounds of renderer container (for positioning/sizing/clipping later)
+ // Subclasses are responsible of firing the 'update' event.
+ var p = this.options.padding,
+ size = this._map.getSize(),
+ min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
+
+ this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
+
+ this._center = this._map.getCenter();
+ this._zoom = this._map.getZoom();
+ }
+});
diff --git a/node_modules/leaflet/src/layer/vector/SVG.Util.js b/node_modules/leaflet/src/layer/vector/SVG.Util.js
new file mode 100644
index 0000000000000000000000000000000000000000..9c7fd9394b5f8dc70b3b7ebf45529cf37d02a7b1
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/SVG.Util.js
@@ -0,0 +1,39 @@
+import Browser from '../../core/Browser';
+
+// @namespace SVG; @section
+// There are several static functions which can be called without instantiating L.SVG:
+
+// @function create(name: String): SVGElement
+// Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),
+// corresponding to the class name passed. For example, using 'line' will return
+// an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).
+export function svgCreate(name) {
+ return document.createElementNS('http://www.w3.org/2000/svg', name);
+}
+
+// @function pointsToPath(rings: Point[], closed: Boolean): String
+// Generates a SVG path string for multiple rings, with each ring turning
+// into "M..L..L.." instructions
+export function pointsToPath(rings, closed) {
+ var str = '',
+ i, j, len, len2, points, p;
+
+ for (i = 0, len = rings.length; i < len; i++) {
+ points = rings[i];
+
+ for (j = 0, len2 = points.length; j < len2; j++) {
+ p = points[j];
+ str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
+ }
+
+ // closes the ring for polygons; "x" is VML syntax
+ str += closed ? (Browser.svg ? 'z' : 'x') : '';
+ }
+
+ // SVG complains about empty path strings
+ return str || 'M0 0';
+}
+
+
+
+
diff --git a/node_modules/leaflet/src/layer/vector/SVG.VML.js b/node_modules/leaflet/src/layer/vector/SVG.VML.js
new file mode 100644
index 0000000000000000000000000000000000000000..209f14b98f10efc1a77dee17b281d3450a6b3732
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/SVG.VML.js
@@ -0,0 +1,144 @@
+import * as DomUtil from '../../dom/DomUtil';
+import * as Util from '../../core/Util';
+import {Renderer} from './Renderer';
+
+/*
+ * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
+ */
+
+
+export var vmlCreate = (function () {
+ try {
+ document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
+ return function (name) {
+ return document.createElement('');
+ };
+ } catch (e) {
+ // Do not return fn from catch block so `e` can be garbage collected
+ // See https://github.com/Leaflet/Leaflet/pull/7279
+ }
+ return function (name) {
+ return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
+ };
+})();
+
+
+/*
+ * @class SVG
+ *
+ *
+ * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
+ * with old versions of Internet Explorer.
+ */
+
+// mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences
+export var vmlMixin = {
+
+ _initContainer: function () {
+ this._container = DomUtil.create('div', 'leaflet-vml-container');
+ },
+
+ _update: function () {
+ if (this._map._animatingZoom) { return; }
+ Renderer.prototype._update.call(this);
+ this.fire('update');
+ },
+
+ _initPath: function (layer) {
+ var container = layer._container = vmlCreate('shape');
+
+ DomUtil.addClass(container, 'leaflet-vml-shape ' + (this.options.className || ''));
+
+ container.coordsize = '1 1';
+
+ layer._path = vmlCreate('path');
+ container.appendChild(layer._path);
+
+ this._updateStyle(layer);
+ this._layers[Util.stamp(layer)] = layer;
+ },
+
+ _addPath: function (layer) {
+ var container = layer._container;
+ this._container.appendChild(container);
+
+ if (layer.options.interactive) {
+ layer.addInteractiveTarget(container);
+ }
+ },
+
+ _removePath: function (layer) {
+ var container = layer._container;
+ DomUtil.remove(container);
+ layer.removeInteractiveTarget(container);
+ delete this._layers[Util.stamp(layer)];
+ },
+
+ _updateStyle: function (layer) {
+ var stroke = layer._stroke,
+ fill = layer._fill,
+ options = layer.options,
+ container = layer._container;
+
+ container.stroked = !!options.stroke;
+ container.filled = !!options.fill;
+
+ if (options.stroke) {
+ if (!stroke) {
+ stroke = layer._stroke = vmlCreate('stroke');
+ }
+ container.appendChild(stroke);
+ stroke.weight = options.weight + 'px';
+ stroke.color = options.color;
+ stroke.opacity = options.opacity;
+
+ if (options.dashArray) {
+ stroke.dashStyle = Util.isArray(options.dashArray) ?
+ options.dashArray.join(' ') :
+ options.dashArray.replace(/( *, *)/g, ' ');
+ } else {
+ stroke.dashStyle = '';
+ }
+ stroke.endcap = options.lineCap.replace('butt', 'flat');
+ stroke.joinstyle = options.lineJoin;
+
+ } else if (stroke) {
+ container.removeChild(stroke);
+ layer._stroke = null;
+ }
+
+ if (options.fill) {
+ if (!fill) {
+ fill = layer._fill = vmlCreate('fill');
+ }
+ container.appendChild(fill);
+ fill.color = options.fillColor || options.color;
+ fill.opacity = options.fillOpacity;
+
+ } else if (fill) {
+ container.removeChild(fill);
+ layer._fill = null;
+ }
+ },
+
+ _updateCircle: function (layer) {
+ var p = layer._point.round(),
+ r = Math.round(layer._radius),
+ r2 = Math.round(layer._radiusY || r);
+
+ this._setPath(layer, layer._empty() ? 'M0 0' :
+ 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360));
+ },
+
+ _setPath: function (layer, path) {
+ layer._path.v = path;
+ },
+
+ _bringToFront: function (layer) {
+ DomUtil.toFront(layer._container);
+ },
+
+ _bringToBack: function (layer) {
+ DomUtil.toBack(layer._container);
+ }
+};
diff --git a/node_modules/leaflet/src/layer/vector/SVG.js b/node_modules/leaflet/src/layer/vector/SVG.js
new file mode 100644
index 0000000000000000000000000000000000000000..3514992261df1a9cb1586823daeb56c1149382fd
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/SVG.js
@@ -0,0 +1,207 @@
+import {Renderer} from './Renderer';
+import * as DomUtil from '../../dom/DomUtil';
+import * as DomEvent from '../../dom/DomEvent';
+import Browser from '../../core/Browser';
+import {stamp} from '../../core/Util';
+import {svgCreate, pointsToPath} from './SVG.Util';
+export {pointsToPath};
+import {vmlMixin, vmlCreate} from './SVG.VML';
+
+export var create = Browser.vml ? vmlCreate : svgCreate;
+
+/*
+ * @class SVG
+ * @inherits Renderer
+ * @aka L.SVG
+ *
+ * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).
+ * Inherits `Renderer`.
+ *
+ * Due to [technical limitations](https://caniuse.com/svg), SVG is not
+ * available in all web browsers, notably Android 2.x and 3.x.
+ *
+ * Although SVG is not available on IE7 and IE8, these browsers support
+ * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language)
+ * (a now deprecated technology), and the SVG renderer will fall back to VML in
+ * this case.
+ *
+ * @example
+ *
+ * Use SVG by default for all paths in the map:
+ *
+ * ```js
+ * var map = L.map('map', {
+ * renderer: L.svg()
+ * });
+ * ```
+ *
+ * Use a SVG renderer with extra padding for specific vector geometries:
+ *
+ * ```js
+ * var map = L.map('map');
+ * var myRenderer = L.svg({ padding: 0.5 });
+ * var line = L.polyline( coordinates, { renderer: myRenderer } );
+ * var circle = L.circle( center, { renderer: myRenderer } );
+ * ```
+ */
+
+export var SVG = Renderer.extend({
+
+ _initContainer: function () {
+ this._container = create('svg');
+
+ // makes it possible to click through svg root; we'll reset it back in individual paths
+ this._container.setAttribute('pointer-events', 'none');
+
+ this._rootGroup = create('g');
+ this._container.appendChild(this._rootGroup);
+ },
+
+ _destroyContainer: function () {
+ DomUtil.remove(this._container);
+ DomEvent.off(this._container);
+ delete this._container;
+ delete this._rootGroup;
+ delete this._svgSize;
+ },
+
+ _update: function () {
+ if (this._map._animatingZoom && this._bounds) { return; }
+
+ Renderer.prototype._update.call(this);
+
+ var b = this._bounds,
+ size = b.getSize(),
+ container = this._container;
+
+ // set size of svg-container if changed
+ if (!this._svgSize || !this._svgSize.equals(size)) {
+ this._svgSize = size;
+ container.setAttribute('width', size.x);
+ container.setAttribute('height', size.y);
+ }
+
+ // movement: update container viewBox so that we don't have to change coordinates of individual layers
+ DomUtil.setPosition(container, b.min);
+ container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));
+
+ this.fire('update');
+ },
+
+ // methods below are called by vector layers implementations
+
+ _initPath: function (layer) {
+ var path = layer._path = create('path');
+
+ // @namespace Path
+ // @option className: String = null
+ // Custom class name set on an element. Only for SVG renderer.
+ if (layer.options.className) {
+ DomUtil.addClass(path, layer.options.className);
+ }
+
+ if (layer.options.interactive) {
+ DomUtil.addClass(path, 'leaflet-interactive');
+ }
+
+ this._updateStyle(layer);
+ this._layers[stamp(layer)] = layer;
+ },
+
+ _addPath: function (layer) {
+ if (!this._rootGroup) { this._initContainer(); }
+ this._rootGroup.appendChild(layer._path);
+ layer.addInteractiveTarget(layer._path);
+ },
+
+ _removePath: function (layer) {
+ DomUtil.remove(layer._path);
+ layer.removeInteractiveTarget(layer._path);
+ delete this._layers[stamp(layer)];
+ },
+
+ _updatePath: function (layer) {
+ layer._project();
+ layer._update();
+ },
+
+ _updateStyle: function (layer) {
+ var path = layer._path,
+ options = layer.options;
+
+ if (!path) { return; }
+
+ if (options.stroke) {
+ path.setAttribute('stroke', options.color);
+ path.setAttribute('stroke-opacity', options.opacity);
+ path.setAttribute('stroke-width', options.weight);
+ path.setAttribute('stroke-linecap', options.lineCap);
+ path.setAttribute('stroke-linejoin', options.lineJoin);
+
+ if (options.dashArray) {
+ path.setAttribute('stroke-dasharray', options.dashArray);
+ } else {
+ path.removeAttribute('stroke-dasharray');
+ }
+
+ if (options.dashOffset) {
+ path.setAttribute('stroke-dashoffset', options.dashOffset);
+ } else {
+ path.removeAttribute('stroke-dashoffset');
+ }
+ } else {
+ path.setAttribute('stroke', 'none');
+ }
+
+ if (options.fill) {
+ path.setAttribute('fill', options.fillColor || options.color);
+ path.setAttribute('fill-opacity', options.fillOpacity);
+ path.setAttribute('fill-rule', options.fillRule || 'evenodd');
+ } else {
+ path.setAttribute('fill', 'none');
+ }
+ },
+
+ _updatePoly: function (layer, closed) {
+ this._setPath(layer, pointsToPath(layer._parts, closed));
+ },
+
+ _updateCircle: function (layer) {
+ var p = layer._point,
+ r = Math.max(Math.round(layer._radius), 1),
+ r2 = Math.max(Math.round(layer._radiusY), 1) || r,
+ arc = 'a' + r + ',' + r2 + ' 0 1,0 ';
+
+ // drawing a circle with two half-arcs
+ var d = layer._empty() ? 'M0 0' :
+ 'M' + (p.x - r) + ',' + p.y +
+ arc + (r * 2) + ',0 ' +
+ arc + (-r * 2) + ',0 ';
+
+ this._setPath(layer, d);
+ },
+
+ _setPath: function (layer, path) {
+ layer._path.setAttribute('d', path);
+ },
+
+ // SVG does not have the concept of zIndex so we resort to changing the DOM order of elements
+ _bringToFront: function (layer) {
+ DomUtil.toFront(layer._path);
+ },
+
+ _bringToBack: function (layer) {
+ DomUtil.toBack(layer._path);
+ }
+});
+
+if (Browser.vml) {
+ SVG.include(vmlMixin);
+}
+
+// @namespace SVG
+// @factory L.svg(options?: Renderer options)
+// Creates a SVG renderer with the given options.
+export function svg(options) {
+ return Browser.svg || Browser.vml ? new SVG(options) : null;
+}
diff --git a/node_modules/leaflet/src/layer/vector/index.js b/node_modules/leaflet/src/layer/vector/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..2373a419108b2feb3baa64371b362ddc59de0a28
--- /dev/null
+++ b/node_modules/leaflet/src/layer/vector/index.js
@@ -0,0 +1,14 @@
+export {Renderer} from './Renderer';
+export {Canvas, canvas} from './Canvas';
+import {SVG, create, pointsToPath, svg} from './SVG';
+SVG.create = create;
+SVG.pointsToPath = pointsToPath;
+export {SVG, svg};
+import './Renderer.getRenderer'; // This is a bit of a hack, but needed because circular dependencies
+
+export {Path} from './Path';
+export {CircleMarker, circleMarker} from './CircleMarker';
+export {Circle, circle} from './Circle';
+export {Polyline, polyline} from './Polyline';
+export {Polygon, polygon} from './Polygon';
+export {Rectangle, rectangle} from './Rectangle';
diff --git a/node_modules/leaflet/src/map/Map.js b/node_modules/leaflet/src/map/Map.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb7fbcfe01e275bad7f860c1be0560b842e50318
--- /dev/null
+++ b/node_modules/leaflet/src/map/Map.js
@@ -0,0 +1,1751 @@
+import * as Util from '../core/Util';
+import {Evented} from '../core/Events';
+import {EPSG3857} from '../geo/crs/CRS.EPSG3857';
+import {Point, toPoint} from '../geometry/Point';
+import {Bounds, toBounds} from '../geometry/Bounds';
+import {LatLng, toLatLng} from '../geo/LatLng';
+import {LatLngBounds, toLatLngBounds} from '../geo/LatLngBounds';
+import Browser from '../core/Browser';
+import * as DomEvent from '../dom/DomEvent';
+import * as DomUtil from '../dom/DomUtil';
+import {PosAnimation} from '../dom/PosAnimation';
+
+/*
+ * @class Map
+ * @aka L.Map
+ * @inherits Evented
+ *
+ * The central class of the API — it is used to create a map on a page and manipulate it.
+ *
+ * @example
+ *
+ * ```js
+ * // initialize the map on the "map" div with a given center and zoom
+ * var map = L.map('map', {
+ * center: [51.505, -0.09],
+ * zoom: 13
+ * });
+ * ```
+ *
+ */
+
+export var Map = Evented.extend({
+
+ options: {
+ // @section Map State Options
+ // @option crs: CRS = L.CRS.EPSG3857
+ // The [Coordinate Reference System](#crs) to use. Don't change this if you're not
+ // sure what it means.
+ crs: EPSG3857,
+
+ // @option center: LatLng = undefined
+ // Initial geographic center of the map
+ center: undefined,
+
+ // @option zoom: Number = undefined
+ // Initial map zoom level
+ zoom: undefined,
+
+ // @option minZoom: Number = *
+ // Minimum zoom level of the map.
+ // If not specified and at least one `GridLayer` or `TileLayer` is in the map,
+ // the lowest of their `minZoom` options will be used instead.
+ minZoom: undefined,
+
+ // @option maxZoom: Number = *
+ // Maximum zoom level of the map.
+ // If not specified and at least one `GridLayer` or `TileLayer` is in the map,
+ // the highest of their `maxZoom` options will be used instead.
+ maxZoom: undefined,
+
+ // @option layers: Layer[] = []
+ // Array of layers that will be added to the map initially
+ layers: [],
+
+ // @option maxBounds: LatLngBounds = null
+ // When this option is set, the map restricts the view to the given
+ // geographical bounds, bouncing the user back if the user tries to pan
+ // outside the view. To set the restriction dynamically, use
+ // [`setMaxBounds`](#map-setmaxbounds) method.
+ maxBounds: undefined,
+
+ // @option renderer: Renderer = *
+ // The default method for drawing vector layers on the map. `L.SVG`
+ // or `L.Canvas` by default depending on browser support.
+ renderer: undefined,
+
+
+ // @section Animation Options
+ // @option zoomAnimation: Boolean = true
+ // Whether the map zoom animation is enabled. By default it's enabled
+ // in all browsers that support CSS3 Transitions except Android.
+ zoomAnimation: true,
+
+ // @option zoomAnimationThreshold: Number = 4
+ // Won't animate zoom if the zoom difference exceeds this value.
+ zoomAnimationThreshold: 4,
+
+ // @option fadeAnimation: Boolean = true
+ // Whether the tile fade animation is enabled. By default it's enabled
+ // in all browsers that support CSS3 Transitions except Android.
+ fadeAnimation: true,
+
+ // @option markerZoomAnimation: Boolean = true
+ // Whether markers animate their zoom with the zoom animation, if disabled
+ // they will disappear for the length of the animation. By default it's
+ // enabled in all browsers that support CSS3 Transitions except Android.
+ markerZoomAnimation: true,
+
+ // @option transform3DLimit: Number = 2^23
+ // Defines the maximum size of a CSS translation transform. The default
+ // value should not be changed unless a web browser positions layers in
+ // the wrong place after doing a large `panBy`.
+ transform3DLimit: 8388608, // Precision limit of a 32-bit float
+
+ // @section Interaction Options
+ // @option zoomSnap: Number = 1
+ // Forces the map's zoom level to always be a multiple of this, particularly
+ // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.
+ // By default, the zoom level snaps to the nearest integer; lower values
+ // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`
+ // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.
+ zoomSnap: 1,
+
+ // @option zoomDelta: Number = 1
+ // Controls how much the map's zoom level will change after a
+ // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`
+ // or `-` on the keyboard, or using the [zoom controls](#control-zoom).
+ // Values smaller than `1` (e.g. `0.5`) allow for greater granularity.
+ zoomDelta: 1,
+
+ // @option trackResize: Boolean = true
+ // Whether the map automatically handles browser window resize to update itself.
+ trackResize: true
+ },
+
+ initialize: function (id, options) { // (HTMLElement or String, Object)
+ options = Util.setOptions(this, options);
+
+ // Make sure to assign internal flags at the beginning,
+ // to avoid inconsistent state in some edge cases.
+ this._handlers = [];
+ this._layers = {};
+ this._zoomBoundLayers = {};
+ this._sizeChanged = true;
+
+ this._initContainer(id);
+ this._initLayout();
+
+ // hack for https://github.com/Leaflet/Leaflet/issues/1980
+ this._onResize = Util.bind(this._onResize, this);
+
+ this._initEvents();
+
+ if (options.maxBounds) {
+ this.setMaxBounds(options.maxBounds);
+ }
+
+ if (options.zoom !== undefined) {
+ this._zoom = this._limitZoom(options.zoom);
+ }
+
+ if (options.center && options.zoom !== undefined) {
+ this.setView(toLatLng(options.center), options.zoom, {reset: true});
+ }
+
+ this.callInitHooks();
+
+ // don't animate on browsers without hardware-accelerated transitions or old Android/Opera
+ this._zoomAnimated = DomUtil.TRANSITION && Browser.any3d && !Browser.mobileOpera &&
+ this.options.zoomAnimation;
+
+ // zoom transitions run with the same duration for all layers, so if one of transitionend events
+ // happens after starting zoom animation (propagating to the map pane), we know that it ended globally
+ if (this._zoomAnimated) {
+ this._createAnimProxy();
+ DomEvent.on(this._proxy, DomUtil.TRANSITION_END, this._catchTransitionEnd, this);
+ }
+
+ this._addLayers(this.options.layers);
+ },
+
+
+ // @section Methods for modifying map state
+
+ // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this
+ // Sets the view of the map (geographical center and zoom) with the given
+ // animation options.
+ setView: function (center, zoom, options) {
+
+ zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
+ center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);
+ options = options || {};
+
+ this._stop();
+
+ if (this._loaded && !options.reset && options !== true) {
+
+ if (options.animate !== undefined) {
+ options.zoom = Util.extend({animate: options.animate}, options.zoom);
+ options.pan = Util.extend({animate: options.animate, duration: options.duration}, options.pan);
+ }
+
+ // try animating pan or zoom
+ var moved = (this._zoom !== zoom) ?
+ this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :
+ this._tryAnimatedPan(center, options.pan);
+
+ if (moved) {
+ // prevent resize handler call, the view will refresh after animation anyway
+ clearTimeout(this._sizeTimer);
+ return this;
+ }
+ }
+
+ // animation didn't start, just reset the map view
+ this._resetView(center, zoom, options.pan && options.pan.noMoveStart);
+
+ return this;
+ },
+
+ // @method setZoom(zoom: Number, options?: Zoom/pan options): this
+ // Sets the zoom of the map.
+ setZoom: function (zoom, options) {
+ if (!this._loaded) {
+ this._zoom = zoom;
+ return this;
+ }
+ return this.setView(this.getCenter(), zoom, {zoom: options});
+ },
+
+ // @method zoomIn(delta?: Number, options?: Zoom options): this
+ // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
+ zoomIn: function (delta, options) {
+ delta = delta || (Browser.any3d ? this.options.zoomDelta : 1);
+ return this.setZoom(this._zoom + delta, options);
+ },
+
+ // @method zoomOut(delta?: Number, options?: Zoom options): this
+ // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
+ zoomOut: function (delta, options) {
+ delta = delta || (Browser.any3d ? this.options.zoomDelta : 1);
+ return this.setZoom(this._zoom - delta, options);
+ },
+
+ // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this
+ // Zooms the map while keeping a specified geographical point on the map
+ // stationary (e.g. used internally for scroll zoom and double-click zoom).
+ // @alternative
+ // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this
+ // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
+ setZoomAround: function (latlng, zoom, options) {
+ var scale = this.getZoomScale(zoom),
+ viewHalf = this.getSize().divideBy(2),
+ containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),
+
+ centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
+ newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
+
+ return this.setView(newCenter, zoom, {zoom: options});
+ },
+
+ _getBoundsCenterZoom: function (bounds, options) {
+
+ options = options || {};
+ bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);
+
+ var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
+ paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
+
+ zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
+
+ zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom;
+
+ if (zoom === Infinity) {
+ return {
+ center: bounds.getCenter(),
+ zoom: zoom
+ };
+ }
+
+ var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
+
+ swPoint = this.project(bounds.getSouthWest(), zoom),
+ nePoint = this.project(bounds.getNorthEast(), zoom),
+ center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
+
+ return {
+ center: center,
+ zoom: zoom
+ };
+ },
+
+ // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this
+ // Sets a map view that contains the given geographical bounds with the
+ // maximum zoom level possible.
+ fitBounds: function (bounds, options) {
+
+ bounds = toLatLngBounds(bounds);
+
+ if (!bounds.isValid()) {
+ throw new Error('Bounds are not valid.');
+ }
+
+ var target = this._getBoundsCenterZoom(bounds, options);
+ return this.setView(target.center, target.zoom, options);
+ },
+
+ // @method fitWorld(options?: fitBounds options): this
+ // Sets a map view that mostly contains the whole world with the maximum
+ // zoom level possible.
+ fitWorld: function (options) {
+ return this.fitBounds([[-90, -180], [90, 180]], options);
+ },
+
+ // @method panTo(latlng: LatLng, options?: Pan options): this
+ // Pans the map to a given center.
+ panTo: function (center, options) { // (LatLng)
+ return this.setView(center, this._zoom, {pan: options});
+ },
+
+ // @method panBy(offset: Point, options?: Pan options): this
+ // Pans the map by a given number of pixels (animated).
+ panBy: function (offset, options) {
+ offset = toPoint(offset).round();
+ options = options || {};
+
+ if (!offset.x && !offset.y) {
+ return this.fire('moveend');
+ }
+ // If we pan too far, Chrome gets issues with tiles
+ // and makes them disappear or appear in the wrong place (slightly offset) #2602
+ if (options.animate !== true && !this.getSize().contains(offset)) {
+ this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());
+ return this;
+ }
+
+ if (!this._panAnim) {
+ this._panAnim = new PosAnimation();
+
+ this._panAnim.on({
+ 'step': this._onPanTransitionStep,
+ 'end': this._onPanTransitionEnd
+ }, this);
+ }
+
+ // don't fire movestart if animating inertia
+ if (!options.noMoveStart) {
+ this.fire('movestart');
+ }
+
+ // animate pan unless animate: false specified
+ if (options.animate !== false) {
+ DomUtil.addClass(this._mapPane, 'leaflet-pan-anim');
+
+ var newPos = this._getMapPanePos().subtract(offset).round();
+ this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);
+ } else {
+ this._rawPanBy(offset);
+ this.fire('move').fire('moveend');
+ }
+
+ return this;
+ },
+
+ // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this
+ // Sets the view of the map (geographical center and zoom) performing a smooth
+ // pan-zoom animation.
+ flyTo: function (targetCenter, targetZoom, options) {
+
+ options = options || {};
+ if (options.animate === false || !Browser.any3d) {
+ return this.setView(targetCenter, targetZoom, options);
+ }
+
+ this._stop();
+
+ var from = this.project(this.getCenter()),
+ to = this.project(targetCenter),
+ size = this.getSize(),
+ startZoom = this._zoom;
+
+ targetCenter = toLatLng(targetCenter);
+ targetZoom = targetZoom === undefined ? startZoom : targetZoom;
+
+ var w0 = Math.max(size.x, size.y),
+ w1 = w0 * this.getZoomScale(startZoom, targetZoom),
+ u1 = (to.distanceTo(from)) || 1,
+ rho = 1.42,
+ rho2 = rho * rho;
+
+ function r(i) {
+ var s1 = i ? -1 : 1,
+ s2 = i ? w1 : w0,
+ t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,
+ b1 = 2 * s2 * rho2 * u1,
+ b = t1 / b1,
+ sq = Math.sqrt(b * b + 1) - b;
+
+ // workaround for floating point precision bug when sq = 0, log = -Infinite,
+ // thus triggering an infinite loop in flyTo
+ var log = sq < 0.000000001 ? -18 : Math.log(sq);
+
+ return log;
+ }
+
+ function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }
+ function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }
+ function tanh(n) { return sinh(n) / cosh(n); }
+
+ var r0 = r(0);
+
+ function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }
+ function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }
+
+ function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }
+
+ var start = Date.now(),
+ S = (r(1) - r0) / rho,
+ duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;
+
+ function frame() {
+ var t = (Date.now() - start) / duration,
+ s = easeOut(t) * S;
+
+ if (t <= 1) {
+ this._flyToFrame = Util.requestAnimFrame(frame, this);
+
+ this._move(
+ this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),
+ this.getScaleZoom(w0 / w(s), startZoom),
+ {flyTo: true});
+
+ } else {
+ this
+ ._move(targetCenter, targetZoom)
+ ._moveEnd(true);
+ }
+ }
+
+ this._moveStart(true, options.noMoveStart);
+
+ frame.call(this);
+ return this;
+ },
+
+ // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this
+ // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),
+ // but takes a bounds parameter like [`fitBounds`](#map-fitbounds).
+ flyToBounds: function (bounds, options) {
+ var target = this._getBoundsCenterZoom(bounds, options);
+ return this.flyTo(target.center, target.zoom, options);
+ },
+
+ // @method setMaxBounds(bounds: LatLngBounds): this
+ // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).
+ setMaxBounds: function (bounds) {
+ bounds = toLatLngBounds(bounds);
+
+ if (this.listens('moveend', this._panInsideMaxBounds)) {
+ this.off('moveend', this._panInsideMaxBounds);
+ }
+
+ if (!bounds.isValid()) {
+ this.options.maxBounds = null;
+ return this;
+ }
+
+ this.options.maxBounds = bounds;
+
+ if (this._loaded) {
+ this._panInsideMaxBounds();
+ }
+
+ return this.on('moveend', this._panInsideMaxBounds);
+ },
+
+ // @method setMinZoom(zoom: Number): this
+ // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).
+ setMinZoom: function (zoom) {
+ var oldZoom = this.options.minZoom;
+ this.options.minZoom = zoom;
+
+ if (this._loaded && oldZoom !== zoom) {
+ this.fire('zoomlevelschange');
+
+ if (this.getZoom() < this.options.minZoom) {
+ return this.setZoom(zoom);
+ }
+ }
+
+ return this;
+ },
+
+ // @method setMaxZoom(zoom: Number): this
+ // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).
+ setMaxZoom: function (zoom) {
+ var oldZoom = this.options.maxZoom;
+ this.options.maxZoom = zoom;
+
+ if (this._loaded && oldZoom !== zoom) {
+ this.fire('zoomlevelschange');
+
+ if (this.getZoom() > this.options.maxZoom) {
+ return this.setZoom(zoom);
+ }
+ }
+
+ return this;
+ },
+
+ // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this
+ // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
+ panInsideBounds: function (bounds, options) {
+ this._enforcingBounds = true;
+ var center = this.getCenter(),
+ newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));
+
+ if (!center.equals(newCenter)) {
+ this.panTo(newCenter, options);
+ }
+
+ this._enforcingBounds = false;
+ return this;
+ },
+
+ // @method panInside(latlng: LatLng, options?: padding options): this
+ // Pans the map the minimum amount to make the `latlng` visible. Use
+ // padding options to fit the display to more restricted bounds.
+ // If `latlng` is already within the (optionally padded) display bounds,
+ // the map will not be panned.
+ panInside: function (latlng, options) {
+ options = options || {};
+
+ var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
+ paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
+ pixelCenter = this.project(this.getCenter()),
+ pixelPoint = this.project(latlng),
+ pixelBounds = this.getPixelBounds(),
+ paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]),
+ paddedSize = paddedBounds.getSize();
+
+ if (!paddedBounds.contains(pixelPoint)) {
+ this._enforcingBounds = true;
+ var centerOffset = pixelPoint.subtract(paddedBounds.getCenter());
+ var offset = paddedBounds.extend(pixelPoint).getSize().subtract(paddedSize);
+ pixelCenter.x += centerOffset.x < 0 ? -offset.x : offset.x;
+ pixelCenter.y += centerOffset.y < 0 ? -offset.y : offset.y;
+ this.panTo(this.unproject(pixelCenter), options);
+ this._enforcingBounds = false;
+ }
+ return this;
+ },
+
+ // @method invalidateSize(options: Zoom/pan options): this
+ // Checks if the map container size changed and updates the map if so —
+ // call it after you've changed the map size dynamically, also animating
+ // pan by default. If `options.pan` is `false`, panning will not occur.
+ // If `options.debounceMoveend` is `true`, it will delay `moveend` event so
+ // that it doesn't happen often even if the method is called many
+ // times in a row.
+
+ // @alternative
+ // @method invalidateSize(animate: Boolean): this
+ // Checks if the map container size changed and updates the map if so —
+ // call it after you've changed the map size dynamically, also animating
+ // pan by default.
+ invalidateSize: function (options) {
+ if (!this._loaded) { return this; }
+
+ options = Util.extend({
+ animate: false,
+ pan: true
+ }, options === true ? {animate: true} : options);
+
+ var oldSize = this.getSize();
+ this._sizeChanged = true;
+ this._lastCenter = null;
+
+ var newSize = this.getSize(),
+ oldCenter = oldSize.divideBy(2).round(),
+ newCenter = newSize.divideBy(2).round(),
+ offset = oldCenter.subtract(newCenter);
+
+ if (!offset.x && !offset.y) { return this; }
+
+ if (options.animate && options.pan) {
+ this.panBy(offset);
+
+ } else {
+ if (options.pan) {
+ this._rawPanBy(offset);
+ }
+
+ this.fire('move');
+
+ if (options.debounceMoveend) {
+ clearTimeout(this._sizeTimer);
+ this._sizeTimer = setTimeout(Util.bind(this.fire, this, 'moveend'), 200);
+ } else {
+ this.fire('moveend');
+ }
+ }
+
+ // @section Map state change events
+ // @event resize: ResizeEvent
+ // Fired when the map is resized.
+ return this.fire('resize', {
+ oldSize: oldSize,
+ newSize: newSize
+ });
+ },
+
+ // @section Methods for modifying map state
+ // @method stop(): this
+ // Stops the currently running `panTo` or `flyTo` animation, if any.
+ stop: function () {
+ this.setZoom(this._limitZoom(this._zoom));
+ if (!this.options.zoomSnap) {
+ this.fire('viewreset');
+ }
+ return this._stop();
+ },
+
+ // @section Geolocation methods
+ // @method locate(options?: Locate options): this
+ // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)
+ // event with location data on success or a [`locationerror`](#map-locationerror) event on failure,
+ // and optionally sets the map view to the user's location with respect to
+ // detection accuracy (or to the world view if geolocation failed).
+ // Note that, if your page doesn't use HTTPS, this method will fail in
+ // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))
+ // See `Locate options` for more details.
+ locate: function (options) {
+
+ options = this._locateOptions = Util.extend({
+ timeout: 10000,
+ watch: false
+ // setView: false
+ // maxZoom:
+ // maximumAge: 0
+ // enableHighAccuracy: false
+ }, options);
+
+ if (!('geolocation' in navigator)) {
+ this._handleGeolocationError({
+ code: 0,
+ message: 'Geolocation not supported.'
+ });
+ return this;
+ }
+
+ var onResponse = Util.bind(this._handleGeolocationResponse, this),
+ onError = Util.bind(this._handleGeolocationError, this);
+
+ if (options.watch) {
+ this._locationWatchId =
+ navigator.geolocation.watchPosition(onResponse, onError, options);
+ } else {
+ navigator.geolocation.getCurrentPosition(onResponse, onError, options);
+ }
+ return this;
+ },
+
+ // @method stopLocate(): this
+ // Stops watching location previously initiated by `map.locate({watch: true})`
+ // and aborts resetting the map view if map.locate was called with
+ // `{setView: true}`.
+ stopLocate: function () {
+ if (navigator.geolocation && navigator.geolocation.clearWatch) {
+ navigator.geolocation.clearWatch(this._locationWatchId);
+ }
+ if (this._locateOptions) {
+ this._locateOptions.setView = false;
+ }
+ return this;
+ },
+
+ _handleGeolocationError: function (error) {
+ if (!this._container._leaflet_id) { return; }
+
+ var c = error.code,
+ message = error.message ||
+ (c === 1 ? 'permission denied' :
+ (c === 2 ? 'position unavailable' : 'timeout'));
+
+ if (this._locateOptions.setView && !this._loaded) {
+ this.fitWorld();
+ }
+
+ // @section Location events
+ // @event locationerror: ErrorEvent
+ // Fired when geolocation (using the [`locate`](#map-locate) method) failed.
+ this.fire('locationerror', {
+ code: c,
+ message: 'Geolocation error: ' + message + '.'
+ });
+ },
+
+ _handleGeolocationResponse: function (pos) {
+ if (!this._container._leaflet_id) { return; }
+
+ var lat = pos.coords.latitude,
+ lng = pos.coords.longitude,
+ latlng = new LatLng(lat, lng),
+ bounds = latlng.toBounds(pos.coords.accuracy * 2),
+ options = this._locateOptions;
+
+ if (options.setView) {
+ var zoom = this.getBoundsZoom(bounds);
+ this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);
+ }
+
+ var data = {
+ latlng: latlng,
+ bounds: bounds,
+ timestamp: pos.timestamp
+ };
+
+ for (var i in pos.coords) {
+ if (typeof pos.coords[i] === 'number') {
+ data[i] = pos.coords[i];
+ }
+ }
+
+ // @event locationfound: LocationEvent
+ // Fired when geolocation (using the [`locate`](#map-locate) method)
+ // went successfully.
+ this.fire('locationfound', data);
+ },
+
+ // TODO Appropriate docs section?
+ // @section Other Methods
+ // @method addHandler(name: String, HandlerClass: Function): this
+ // Adds a new `Handler` to the map, given its name and constructor function.
+ addHandler: function (name, HandlerClass) {
+ if (!HandlerClass) { return this; }
+
+ var handler = this[name] = new HandlerClass(this);
+
+ this._handlers.push(handler);
+
+ if (this.options[name]) {
+ handler.enable();
+ }
+
+ return this;
+ },
+
+ // @method remove(): this
+ // Destroys the map and clears all related event listeners.
+ remove: function () {
+
+ this._initEvents(true);
+ if (this.options.maxBounds) { this.off('moveend', this._panInsideMaxBounds); }
+
+ if (this._containerId !== this._container._leaflet_id) {
+ throw new Error('Map container is being reused by another instance');
+ }
+
+ try {
+ // throws error in IE6-8
+ delete this._container._leaflet_id;
+ delete this._containerId;
+ } catch (e) {
+ /*eslint-disable */
+ this._container._leaflet_id = undefined;
+ /* eslint-enable */
+ this._containerId = undefined;
+ }
+
+ if (this._locationWatchId !== undefined) {
+ this.stopLocate();
+ }
+
+ this._stop();
+
+ DomUtil.remove(this._mapPane);
+
+ if (this._clearControlPos) {
+ this._clearControlPos();
+ }
+ if (this._resizeRequest) {
+ Util.cancelAnimFrame(this._resizeRequest);
+ this._resizeRequest = null;
+ }
+
+ this._clearHandlers();
+
+ if (this._loaded) {
+ // @section Map state change events
+ // @event unload: Event
+ // Fired when the map is destroyed with [remove](#map-remove) method.
+ this.fire('unload');
+ }
+
+ var i;
+ for (i in this._layers) {
+ this._layers[i].remove();
+ }
+ for (i in this._panes) {
+ DomUtil.remove(this._panes[i]);
+ }
+
+ this._layers = [];
+ this._panes = [];
+ delete this._mapPane;
+ delete this._renderer;
+
+ return this;
+ },
+
+ // @section Other Methods
+ // @method createPane(name: String, container?: HTMLElement): HTMLElement
+ // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,
+ // then returns it. The pane is created as a child of `container`, or
+ // as a child of the main map pane if not set.
+ createPane: function (name, container) {
+ var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),
+ pane = DomUtil.create('div', className, container || this._mapPane);
+
+ if (name) {
+ this._panes[name] = pane;
+ }
+ return pane;
+ },
+
+ // @section Methods for Getting Map State
+
+ // @method getCenter(): LatLng
+ // Returns the geographical center of the map view
+ getCenter: function () {
+ this._checkIfLoaded();
+
+ if (this._lastCenter && !this._moved()) {
+ return this._lastCenter.clone();
+ }
+ return this.layerPointToLatLng(this._getCenterLayerPoint());
+ },
+
+ // @method getZoom(): Number
+ // Returns the current zoom level of the map view
+ getZoom: function () {
+ return this._zoom;
+ },
+
+ // @method getBounds(): LatLngBounds
+ // Returns the geographical bounds visible in the current map view
+ getBounds: function () {
+ var bounds = this.getPixelBounds(),
+ sw = this.unproject(bounds.getBottomLeft()),
+ ne = this.unproject(bounds.getTopRight());
+
+ return new LatLngBounds(sw, ne);
+ },
+
+ // @method getMinZoom(): Number
+ // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.
+ getMinZoom: function () {
+ return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;
+ },
+
+ // @method getMaxZoom(): Number
+ // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).
+ getMaxZoom: function () {
+ return this.options.maxZoom === undefined ?
+ (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :
+ this.options.maxZoom;
+ },
+
+ // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number
+ // Returns the maximum zoom level on which the given bounds fit to the map
+ // view in its entirety. If `inside` (optional) is set to `true`, the method
+ // instead returns the minimum zoom level on which the map view fits into
+ // the given bounds in its entirety.
+ getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
+ bounds = toLatLngBounds(bounds);
+ padding = toPoint(padding || [0, 0]);
+
+ var zoom = this.getZoom() || 0,
+ min = this.getMinZoom(),
+ max = this.getMaxZoom(),
+ nw = bounds.getNorthWest(),
+ se = bounds.getSouthEast(),
+ size = this.getSize().subtract(padding),
+ boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),
+ snap = Browser.any3d ? this.options.zoomSnap : 1,
+ scalex = size.x / boundsSize.x,
+ scaley = size.y / boundsSize.y,
+ scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
+
+ zoom = this.getScaleZoom(scale, zoom);
+
+ if (snap) {
+ zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level
+ zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;
+ }
+
+ return Math.max(min, Math.min(max, zoom));
+ },
+
+ // @method getSize(): Point
+ // Returns the current size of the map container (in pixels).
+ getSize: function () {
+ if (!this._size || this._sizeChanged) {
+ this._size = new Point(
+ this._container.clientWidth || 0,
+ this._container.clientHeight || 0);
+
+ this._sizeChanged = false;
+ }
+ return this._size.clone();
+ },
+
+ // @method getPixelBounds(): Bounds
+ // Returns the bounds of the current map view in projected pixel
+ // coordinates (sometimes useful in layer and overlay implementations).
+ getPixelBounds: function (center, zoom) {
+ var topLeftPoint = this._getTopLeftPoint(center, zoom);
+ return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));
+ },
+
+ // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to
+ // the map pane? "left point of the map layer" can be confusing, specially
+ // since there can be negative offsets.
+ // @method getPixelOrigin(): Point
+ // Returns the projected pixel coordinates of the top left point of
+ // the map layer (useful in custom layer and overlay implementations).
+ getPixelOrigin: function () {
+ this._checkIfLoaded();
+ return this._pixelOrigin;
+ },
+
+ // @method getPixelWorldBounds(zoom?: Number): Bounds
+ // Returns the world's bounds in pixel coordinates for zoom level `zoom`.
+ // If `zoom` is omitted, the map's current zoom level is used.
+ getPixelWorldBounds: function (zoom) {
+ return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);
+ },
+
+ // @section Other Methods
+
+ // @method getPane(pane: String|HTMLElement): HTMLElement
+ // Returns a [map pane](#map-pane), given its name or its HTML element (its identity).
+ getPane: function (pane) {
+ return typeof pane === 'string' ? this._panes[pane] : pane;
+ },
+
+ // @method getPanes(): Object
+ // Returns a plain object containing the names of all [panes](#map-pane) as keys and
+ // the panes as values.
+ getPanes: function () {
+ return this._panes;
+ },
+
+ // @method getContainer: HTMLElement
+ // Returns the HTML element that contains the map.
+ getContainer: function () {
+ return this._container;
+ },
+
+
+ // @section Conversion Methods
+
+ // @method getZoomScale(toZoom: Number, fromZoom: Number): Number
+ // Returns the scale factor to be applied to a map transition from zoom level
+ // `fromZoom` to `toZoom`. Used internally to help with zoom animations.
+ getZoomScale: function (toZoom, fromZoom) {
+ // TODO replace with universal implementation after refactoring projections
+ var crs = this.options.crs;
+ fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
+ return crs.scale(toZoom) / crs.scale(fromZoom);
+ },
+
+ // @method getScaleZoom(scale: Number, fromZoom: Number): Number
+ // Returns the zoom level that the map would end up at, if it is at `fromZoom`
+ // level and everything is scaled by a factor of `scale`. Inverse of
+ // [`getZoomScale`](#map-getZoomScale).
+ getScaleZoom: function (scale, fromZoom) {
+ var crs = this.options.crs;
+ fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
+ var zoom = crs.zoom(scale * crs.scale(fromZoom));
+ return isNaN(zoom) ? Infinity : zoom;
+ },
+
+ // @method project(latlng: LatLng, zoom: Number): Point
+ // Projects a geographical coordinate `LatLng` according to the projection
+ // of the map's CRS, then scales it according to `zoom` and the CRS's
+ // `Transformation`. The result is pixel coordinate relative to
+ // the CRS origin.
+ project: function (latlng, zoom) {
+ zoom = zoom === undefined ? this._zoom : zoom;
+ return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);
+ },
+
+ // @method unproject(point: Point, zoom: Number): LatLng
+ // Inverse of [`project`](#map-project).
+ unproject: function (point, zoom) {
+ zoom = zoom === undefined ? this._zoom : zoom;
+ return this.options.crs.pointToLatLng(toPoint(point), zoom);
+ },
+
+ // @method layerPointToLatLng(point: Point): LatLng
+ // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
+ // returns the corresponding geographical coordinate (for the current zoom level).
+ layerPointToLatLng: function (point) {
+ var projectedPoint = toPoint(point).add(this.getPixelOrigin());
+ return this.unproject(projectedPoint);
+ },
+
+ // @method latLngToLayerPoint(latlng: LatLng): Point
+ // Given a geographical coordinate, returns the corresponding pixel coordinate
+ // relative to the [origin pixel](#map-getpixelorigin).
+ latLngToLayerPoint: function (latlng) {
+ var projectedPoint = this.project(toLatLng(latlng))._round();
+ return projectedPoint._subtract(this.getPixelOrigin());
+ },
+
+ // @method wrapLatLng(latlng: LatLng): LatLng
+ // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the
+ // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the
+ // CRS's bounds.
+ // By default this means longitude is wrapped around the dateline so its
+ // value is between -180 and +180 degrees.
+ wrapLatLng: function (latlng) {
+ return this.options.crs.wrapLatLng(toLatLng(latlng));
+ },
+
+ // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
+ // Returns a `LatLngBounds` with the same size as the given one, ensuring that
+ // its center is within the CRS's bounds.
+ // By default this means the center longitude is wrapped around the dateline so its
+ // value is between -180 and +180 degrees, and the majority of the bounds
+ // overlaps the CRS's bounds.
+ wrapLatLngBounds: function (latlng) {
+ return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));
+ },
+
+ // @method distance(latlng1: LatLng, latlng2: LatLng): Number
+ // Returns the distance between two geographical coordinates according to
+ // the map's CRS. By default this measures distance in meters.
+ distance: function (latlng1, latlng2) {
+ return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));
+ },
+
+ // @method containerPointToLayerPoint(point: Point): Point
+ // Given a pixel coordinate relative to the map container, returns the corresponding
+ // pixel coordinate relative to the [origin pixel](#map-getpixelorigin).
+ containerPointToLayerPoint: function (point) { // (Point)
+ return toPoint(point).subtract(this._getMapPanePos());
+ },
+
+ // @method layerPointToContainerPoint(point: Point): Point
+ // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
+ // returns the corresponding pixel coordinate relative to the map container.
+ layerPointToContainerPoint: function (point) { // (Point)
+ return toPoint(point).add(this._getMapPanePos());
+ },
+
+ // @method containerPointToLatLng(point: Point): LatLng
+ // Given a pixel coordinate relative to the map container, returns
+ // the corresponding geographical coordinate (for the current zoom level).
+ containerPointToLatLng: function (point) {
+ var layerPoint = this.containerPointToLayerPoint(toPoint(point));
+ return this.layerPointToLatLng(layerPoint);
+ },
+
+ // @method latLngToContainerPoint(latlng: LatLng): Point
+ // Given a geographical coordinate, returns the corresponding pixel coordinate
+ // relative to the map container.
+ latLngToContainerPoint: function (latlng) {
+ return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));
+ },
+
+ // @method mouseEventToContainerPoint(ev: MouseEvent): Point
+ // Given a MouseEvent object, returns the pixel coordinate relative to the
+ // map container where the event took place.
+ mouseEventToContainerPoint: function (e) {
+ return DomEvent.getMousePosition(e, this._container);
+ },
+
+ // @method mouseEventToLayerPoint(ev: MouseEvent): Point
+ // Given a MouseEvent object, returns the pixel coordinate relative to
+ // the [origin pixel](#map-getpixelorigin) where the event took place.
+ mouseEventToLayerPoint: function (e) {
+ return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));
+ },
+
+ // @method mouseEventToLatLng(ev: MouseEvent): LatLng
+ // Given a MouseEvent object, returns geographical coordinate where the
+ // event took place.
+ mouseEventToLatLng: function (e) { // (MouseEvent)
+ return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));
+ },
+
+
+ // map initialization methods
+
+ _initContainer: function (id) {
+ var container = this._container = DomUtil.get(id);
+
+ if (!container) {
+ throw new Error('Map container not found.');
+ } else if (container._leaflet_id) {
+ throw new Error('Map container is already initialized.');
+ }
+
+ DomEvent.on(container, 'scroll', this._onScroll, this);
+ this._containerId = Util.stamp(container);
+ },
+
+ _initLayout: function () {
+ var container = this._container;
+
+ this._fadeAnimated = this.options.fadeAnimation && Browser.any3d;
+
+ DomUtil.addClass(container, 'leaflet-container' +
+ (Browser.touch ? ' leaflet-touch' : '') +
+ (Browser.retina ? ' leaflet-retina' : '') +
+ (Browser.ielt9 ? ' leaflet-oldie' : '') +
+ (Browser.safari ? ' leaflet-safari' : '') +
+ (this._fadeAnimated ? ' leaflet-fade-anim' : ''));
+
+ var position = DomUtil.getStyle(container, 'position');
+
+ if (position !== 'absolute' && position !== 'relative' && position !== 'fixed' && position !== 'sticky') {
+ container.style.position = 'relative';
+ }
+
+ this._initPanes();
+
+ if (this._initControlPos) {
+ this._initControlPos();
+ }
+ },
+
+ _initPanes: function () {
+ var panes = this._panes = {};
+ this._paneRenderers = {};
+
+ // @section
+ //
+ // Panes are DOM elements used to control the ordering of layers on the map. You
+ // can access panes with [`map.getPane`](#map-getpane) or
+ // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the
+ // [`map.createPane`](#map-createpane) method.
+ //
+ // Every map has the following default panes that differ only in zIndex.
+ //
+ // @pane mapPane: HTMLElement = 'auto'
+ // Pane that contains all other map panes
+
+ this._mapPane = this.createPane('mapPane', this._container);
+ DomUtil.setPosition(this._mapPane, new Point(0, 0));
+
+ // @pane tilePane: HTMLElement = 200
+ // Pane for `GridLayer`s and `TileLayer`s
+ this.createPane('tilePane');
+ // @pane overlayPane: HTMLElement = 400
+ // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s
+ this.createPane('overlayPane');
+ // @pane shadowPane: HTMLElement = 500
+ // Pane for overlay shadows (e.g. `Marker` shadows)
+ this.createPane('shadowPane');
+ // @pane markerPane: HTMLElement = 600
+ // Pane for `Icon`s of `Marker`s
+ this.createPane('markerPane');
+ // @pane tooltipPane: HTMLElement = 650
+ // Pane for `Tooltip`s.
+ this.createPane('tooltipPane');
+ // @pane popupPane: HTMLElement = 700
+ // Pane for `Popup`s.
+ this.createPane('popupPane');
+
+ if (!this.options.markerZoomAnimation) {
+ DomUtil.addClass(panes.markerPane, 'leaflet-zoom-hide');
+ DomUtil.addClass(panes.shadowPane, 'leaflet-zoom-hide');
+ }
+ },
+
+
+ // private methods that modify map state
+
+ // @section Map state change events
+ _resetView: function (center, zoom, noMoveStart) {
+ DomUtil.setPosition(this._mapPane, new Point(0, 0));
+
+ var loading = !this._loaded;
+ this._loaded = true;
+ zoom = this._limitZoom(zoom);
+
+ this.fire('viewprereset');
+
+ var zoomChanged = this._zoom !== zoom;
+ this
+ ._moveStart(zoomChanged, noMoveStart)
+ ._move(center, zoom)
+ ._moveEnd(zoomChanged);
+
+ // @event viewreset: Event
+ // Fired when the map needs to redraw its content (this usually happens
+ // on map zoom or load). Very useful for creating custom overlays.
+ this.fire('viewreset');
+
+ // @event load: Event
+ // Fired when the map is initialized (when its center and zoom are set
+ // for the first time).
+ if (loading) {
+ this.fire('load');
+ }
+ },
+
+ _moveStart: function (zoomChanged, noMoveStart) {
+ // @event zoomstart: Event
+ // Fired when the map zoom is about to change (e.g. before zoom animation).
+ // @event movestart: Event
+ // Fired when the view of the map starts changing (e.g. user starts dragging the map).
+ if (zoomChanged) {
+ this.fire('zoomstart');
+ }
+ if (!noMoveStart) {
+ this.fire('movestart');
+ }
+ return this;
+ },
+
+ _move: function (center, zoom, data, supressEvent) {
+ if (zoom === undefined) {
+ zoom = this._zoom;
+ }
+ var zoomChanged = this._zoom !== zoom;
+
+ this._zoom = zoom;
+ this._lastCenter = center;
+ this._pixelOrigin = this._getNewPixelOrigin(center);
+
+ if (!supressEvent) {
+ // @event zoom: Event
+ // Fired repeatedly during any change in zoom level,
+ // including zoom and fly animations.
+ if (zoomChanged || (data && data.pinch)) { // Always fire 'zoom' if pinching because #3530
+ this.fire('zoom', data);
+ }
+
+ // @event move: Event
+ // Fired repeatedly during any movement of the map,
+ // including pan and fly animations.
+ this.fire('move', data);
+ } else if (data && data.pinch) { // Always fire 'zoom' if pinching because #3530
+ this.fire('zoom', data);
+ }
+ return this;
+ },
+
+ _moveEnd: function (zoomChanged) {
+ // @event zoomend: Event
+ // Fired when the map zoom changed, after any animations.
+ if (zoomChanged) {
+ this.fire('zoomend');
+ }
+
+ // @event moveend: Event
+ // Fired when the center of the map stops changing
+ // (e.g. user stopped dragging the map or after non-centered zoom).
+ return this.fire('moveend');
+ },
+
+ _stop: function () {
+ Util.cancelAnimFrame(this._flyToFrame);
+ if (this._panAnim) {
+ this._panAnim.stop();
+ }
+ return this;
+ },
+
+ _rawPanBy: function (offset) {
+ DomUtil.setPosition(this._mapPane, this._getMapPanePos().subtract(offset));
+ },
+
+ _getZoomSpan: function () {
+ return this.getMaxZoom() - this.getMinZoom();
+ },
+
+ _panInsideMaxBounds: function () {
+ if (!this._enforcingBounds) {
+ this.panInsideBounds(this.options.maxBounds);
+ }
+ },
+
+ _checkIfLoaded: function () {
+ if (!this._loaded) {
+ throw new Error('Set map center and zoom first.');
+ }
+ },
+
+ // DOM event handling
+
+ // @section Interaction events
+ _initEvents: function (remove) {
+ this._targets = {};
+ this._targets[Util.stamp(this._container)] = this;
+
+ var onOff = remove ? DomEvent.off : DomEvent.on;
+
+ // @event click: MouseEvent
+ // Fired when the user clicks (or taps) the map.
+ // @event dblclick: MouseEvent
+ // Fired when the user double-clicks (or double-taps) the map.
+ // @event mousedown: MouseEvent
+ // Fired when the user pushes the mouse button on the map.
+ // @event mouseup: MouseEvent
+ // Fired when the user releases the mouse button on the map.
+ // @event mouseover: MouseEvent
+ // Fired when the mouse enters the map.
+ // @event mouseout: MouseEvent
+ // Fired when the mouse leaves the map.
+ // @event mousemove: MouseEvent
+ // Fired while the mouse moves over the map.
+ // @event contextmenu: MouseEvent
+ // Fired when the user pushes the right mouse button on the map, prevents
+ // default browser context menu from showing if there are listeners on
+ // this event. Also fired on mobile when the user holds a single touch
+ // for a second (also called long press).
+ // @event keypress: KeyboardEvent
+ // Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
+ // @event keydown: KeyboardEvent
+ // Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event,
+ // the `keydown` event is fired for keys that produce a character value and for keys
+ // that do not produce a character value.
+ // @event keyup: KeyboardEvent
+ // Fired when the user releases a key from the keyboard while the map is focused.
+ onOff(this._container, 'click dblclick mousedown mouseup ' +
+ 'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this);
+
+ if (this.options.trackResize) {
+ onOff(window, 'resize', this._onResize, this);
+ }
+
+ if (Browser.any3d && this.options.transform3DLimit) {
+ (remove ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);
+ }
+ },
+
+ _onResize: function () {
+ Util.cancelAnimFrame(this._resizeRequest);
+ this._resizeRequest = Util.requestAnimFrame(
+ function () { this.invalidateSize({debounceMoveend: true}); }, this);
+ },
+
+ _onScroll: function () {
+ this._container.scrollTop = 0;
+ this._container.scrollLeft = 0;
+ },
+
+ _onMoveEnd: function () {
+ var pos = this._getMapPanePos();
+ if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have
+ // a pixel offset on very high values, see: https://jsfiddle.net/dg6r5hhb/
+ this._resetView(this.getCenter(), this.getZoom());
+ }
+ },
+
+ _findEventTargets: function (e, type) {
+ var targets = [],
+ target,
+ isHover = type === 'mouseout' || type === 'mouseover',
+ src = e.target || e.srcElement,
+ dragging = false;
+
+ while (src) {
+ target = this._targets[Util.stamp(src)];
+ if (target && (type === 'click' || type === 'preclick') && this._draggableMoved(target)) {
+ // Prevent firing click after you just dragged an object.
+ dragging = true;
+ break;
+ }
+ if (target && target.listens(type, true)) {
+ if (isHover && !DomEvent.isExternalTarget(src, e)) { break; }
+ targets.push(target);
+ if (isHover) { break; }
+ }
+ if (src === this._container) { break; }
+ src = src.parentNode;
+ }
+ if (!targets.length && !dragging && !isHover && this.listens(type, true)) {
+ targets = [this];
+ }
+ return targets;
+ },
+
+ _isClickDisabled: function (el) {
+ while (el && el !== this._container) {
+ if (el['_leaflet_disable_click']) { return true; }
+ el = el.parentNode;
+ }
+ },
+
+ _handleDOMEvent: function (e) {
+ var el = (e.target || e.srcElement);
+ if (!this._loaded || el['_leaflet_disable_events'] || e.type === 'click' && this._isClickDisabled(el)) {
+ return;
+ }
+
+ var type = e.type;
+
+ if (type === 'mousedown') {
+ // prevents outline when clicking on keyboard-focusable element
+ DomUtil.preventOutline(el);
+ }
+
+ this._fireDOMEvent(e, type);
+ },
+
+ _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],
+
+ _fireDOMEvent: function (e, type, canvasTargets) {
+
+ if (e.type === 'click') {
+ // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).
+ // @event preclick: MouseEvent
+ // Fired before mouse click on the map (sometimes useful when you
+ // want something to happen on click before any existing click
+ // handlers start running).
+ var synth = Util.extend({}, e);
+ synth.type = 'preclick';
+ this._fireDOMEvent(synth, synth.type, canvasTargets);
+ }
+
+ // Find the layer the event is propagating from and its parents.
+ var targets = this._findEventTargets(e, type);
+
+ if (canvasTargets) {
+ var filtered = []; // pick only targets with listeners
+ for (var i = 0; i < canvasTargets.length; i++) {
+ if (canvasTargets[i].listens(type, true)) {
+ filtered.push(canvasTargets[i]);
+ }
+ }
+ targets = filtered.concat(targets);
+ }
+
+ if (!targets.length) { return; }
+
+ if (type === 'contextmenu') {
+ DomEvent.preventDefault(e);
+ }
+
+ var target = targets[0];
+ var data = {
+ originalEvent: e
+ };
+
+ if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') {
+ var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);
+ data.containerPoint = isMarker ?
+ this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);
+ data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);
+ data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);
+ }
+
+ for (i = 0; i < targets.length; i++) {
+ targets[i].fire(type, data, true);
+ if (data.originalEvent._stopped ||
+ (targets[i].options.bubblingMouseEvents === false && Util.indexOf(this._mouseEvents, type) !== -1)) { return; }
+ }
+ },
+
+ _draggableMoved: function (obj) {
+ obj = obj.dragging && obj.dragging.enabled() ? obj : this;
+ return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());
+ },
+
+ _clearHandlers: function () {
+ for (var i = 0, len = this._handlers.length; i < len; i++) {
+ this._handlers[i].disable();
+ }
+ },
+
+ // @section Other Methods
+
+ // @method whenReady(fn: Function, context?: Object): this
+ // Runs the given function `fn` when the map gets initialized with
+ // a view (center and zoom) and at least one layer, or immediately
+ // if it's already initialized, optionally passing a function context.
+ whenReady: function (callback, context) {
+ if (this._loaded) {
+ callback.call(context || this, {target: this});
+ } else {
+ this.on('load', callback, context);
+ }
+ return this;
+ },
+
+
+ // private methods for getting map state
+
+ _getMapPanePos: function () {
+ return DomUtil.getPosition(this._mapPane) || new Point(0, 0);
+ },
+
+ _moved: function () {
+ var pos = this._getMapPanePos();
+ return pos && !pos.equals([0, 0]);
+ },
+
+ _getTopLeftPoint: function (center, zoom) {
+ var pixelOrigin = center && zoom !== undefined ?
+ this._getNewPixelOrigin(center, zoom) :
+ this.getPixelOrigin();
+ return pixelOrigin.subtract(this._getMapPanePos());
+ },
+
+ _getNewPixelOrigin: function (center, zoom) {
+ var viewHalf = this.getSize()._divideBy(2);
+ return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();
+ },
+
+ _latLngToNewLayerPoint: function (latlng, zoom, center) {
+ var topLeft = this._getNewPixelOrigin(center, zoom);
+ return this.project(latlng, zoom)._subtract(topLeft);
+ },
+
+ _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {
+ var topLeft = this._getNewPixelOrigin(center, zoom);
+ return toBounds([
+ this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),
+ this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),
+ this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),
+ this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)
+ ]);
+ },
+
+ // layer point of the current center
+ _getCenterLayerPoint: function () {
+ return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
+ },
+
+ // offset of the specified place to the current center in pixels
+ _getCenterOffset: function (latlng) {
+ return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());
+ },
+
+ // adjust center for view to get inside bounds
+ _limitCenter: function (center, zoom, bounds) {
+
+ if (!bounds) { return center; }
+
+ var centerPoint = this.project(center, zoom),
+ viewHalf = this.getSize().divideBy(2),
+ viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
+ offset = this._getBoundsOffset(viewBounds, bounds, zoom);
+
+ // If offset is less than a pixel, ignore.
+ // This prevents unstable projections from getting into
+ // an infinite loop of tiny offsets.
+ if (Math.abs(offset.x) <= 1 && Math.abs(offset.y) <= 1) {
+ return center;
+ }
+
+ return this.unproject(centerPoint.add(offset), zoom);
+ },
+
+ // adjust offset for view to get inside bounds
+ _limitOffset: function (offset, bounds) {
+ if (!bounds) { return offset; }
+
+ var viewBounds = this.getPixelBounds(),
+ newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));
+
+ return offset.add(this._getBoundsOffset(newBounds, bounds));
+ },
+
+ // returns offset needed for pxBounds to get inside maxBounds at a specified zoom
+ _getBoundsOffset: function (pxBounds, maxBounds, zoom) {
+ var projectedMaxBounds = toBounds(
+ this.project(maxBounds.getNorthEast(), zoom),
+ this.project(maxBounds.getSouthWest(), zoom)
+ ),
+ minOffset = projectedMaxBounds.min.subtract(pxBounds.min),
+ maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),
+
+ dx = this._rebound(minOffset.x, -maxOffset.x),
+ dy = this._rebound(minOffset.y, -maxOffset.y);
+
+ return new Point(dx, dy);
+ },
+
+ _rebound: function (left, right) {
+ return left + right > 0 ?
+ Math.round(left - right) / 2 :
+ Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));
+ },
+
+ _limitZoom: function (zoom) {
+ var min = this.getMinZoom(),
+ max = this.getMaxZoom(),
+ snap = Browser.any3d ? this.options.zoomSnap : 1;
+ if (snap) {
+ zoom = Math.round(zoom / snap) * snap;
+ }
+ return Math.max(min, Math.min(max, zoom));
+ },
+
+ _onPanTransitionStep: function () {
+ this.fire('move');
+ },
+
+ _onPanTransitionEnd: function () {
+ DomUtil.removeClass(this._mapPane, 'leaflet-pan-anim');
+ this.fire('moveend');
+ },
+
+ _tryAnimatedPan: function (center, options) {
+ // difference between the new and current centers in pixels
+ var offset = this._getCenterOffset(center)._trunc();
+
+ // don't animate too far unless animate: true specified in options
+ if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }
+
+ this.panBy(offset, options);
+
+ return true;
+ },
+
+ _createAnimProxy: function () {
+
+ var proxy = this._proxy = DomUtil.create('div', 'leaflet-proxy leaflet-zoom-animated');
+ this._panes.mapPane.appendChild(proxy);
+
+ this.on('zoomanim', function (e) {
+ var prop = DomUtil.TRANSFORM,
+ transform = this._proxy.style[prop];
+
+ DomUtil.setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1));
+
+ // workaround for case when transform is the same and so transitionend event is not fired
+ if (transform === this._proxy.style[prop] && this._animatingZoom) {
+ this._onZoomTransitionEnd();
+ }
+ }, this);
+
+ this.on('load moveend', this._animMoveEnd, this);
+
+ this._on('unload', this._destroyAnimProxy, this);
+ },
+
+ _destroyAnimProxy: function () {
+ DomUtil.remove(this._proxy);
+ this.off('load moveend', this._animMoveEnd, this);
+ delete this._proxy;
+ },
+
+ _animMoveEnd: function () {
+ var c = this.getCenter(),
+ z = this.getZoom();
+ DomUtil.setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));
+ },
+
+ _catchTransitionEnd: function (e) {
+ if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {
+ this._onZoomTransitionEnd();
+ }
+ },
+
+ _nothingToAnimate: function () {
+ return !this._container.getElementsByClassName('leaflet-zoom-animated').length;
+ },
+
+ _tryAnimatedZoom: function (center, zoom, options) {
+
+ if (this._animatingZoom) { return true; }
+
+ options = options || {};
+
+ // don't animate if disabled, not supported or zoom difference is too large
+ if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||
+ Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }
+
+ // offset is the pixel coords of the zoom origin relative to the current center
+ var scale = this.getZoomScale(zoom),
+ offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale);
+
+ // don't animate if the zoom origin isn't within one screen from the current center, unless forced
+ if (options.animate !== true && !this.getSize().contains(offset)) { return false; }
+
+ Util.requestAnimFrame(function () {
+ this
+ ._moveStart(true, options.noMoveStart || false)
+ ._animateZoom(center, zoom, true);
+ }, this);
+
+ return true;
+ },
+
+ _animateZoom: function (center, zoom, startAnim, noUpdate) {
+ if (!this._mapPane) { return; }
+
+ if (startAnim) {
+ this._animatingZoom = true;
+
+ // remember what center/zoom to set after animation
+ this._animateToCenter = center;
+ this._animateToZoom = zoom;
+
+ DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');
+ }
+
+ // @section Other Events
+ // @event zoomanim: ZoomAnimEvent
+ // Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
+ this.fire('zoomanim', {
+ center: center,
+ zoom: zoom,
+ noUpdate: noUpdate
+ });
+
+ if (!this._tempFireZoomEvent) {
+ this._tempFireZoomEvent = this._zoom !== this._animateToZoom;
+ }
+
+ this._move(this._animateToCenter, this._animateToZoom, undefined, true);
+
+ // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693
+ setTimeout(Util.bind(this._onZoomTransitionEnd, this), 250);
+ },
+
+ _onZoomTransitionEnd: function () {
+ if (!this._animatingZoom) { return; }
+
+ if (this._mapPane) {
+ DomUtil.removeClass(this._mapPane, 'leaflet-zoom-anim');
+ }
+
+ this._animatingZoom = false;
+
+ this._move(this._animateToCenter, this._animateToZoom, undefined, true);
+
+ if (this._tempFireZoomEvent) {
+ this.fire('zoom');
+ }
+ delete this._tempFireZoomEvent;
+
+ this.fire('move');
+
+ this._moveEnd(true);
+ }
+});
+
+// @section
+
+// @factory L.map(id: String, options?: Map options)
+// Instantiates a map object given the DOM ID of a `
` element
+// and optionally an object literal with `Map options`.
+//
+// @alternative
+// @factory L.map(el: HTMLElement, options?: Map options)
+// Instantiates a map object given an instance of a `