leaflet-js 0.7.9 → 0.8.dev2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +0 -10
  3. data/Rakefile +3 -3
  4. data/leaflet-js.gemspec +7 -13
  5. data/lib/leaflet-js.rb +10 -2
  6. data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
  7. data/lib/leaflet.draw/CHANGELOG.md +130 -0
  8. data/lib/leaflet.draw/Jakefile.js +48 -0
  9. data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
  10. data/lib/leaflet.draw/README.md +427 -0
  11. data/lib/leaflet.draw/TODO.md +62 -0
  12. data/lib/leaflet.draw/build/build.html +243 -0
  13. data/lib/leaflet.draw/build/build.js +187 -0
  14. data/lib/leaflet.draw/build/deps.js +76 -0
  15. data/lib/leaflet.draw/build/hintrc.js +39 -0
  16. data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
  17. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
  18. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet.png +0 -0
  19. data/lib/leaflet.draw/dist/leaflet.draw-src.js +2872 -0
  20. data/lib/leaflet.draw/dist/leaflet.draw.css +295 -0
  21. data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
  22. data/lib/leaflet.draw/examples/basic.html +113 -0
  23. data/lib/leaflet.draw/examples/edithandlers.html +66 -0
  24. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers-2x.png +0 -0
  25. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers.png +0 -0
  26. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon-2x.png +0 -0
  27. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon.png +0 -0
  28. data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
  29. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-shadow.png +0 -0
  30. data/lib/leaflet.draw/examples/libs/leaflet-src.js +9191 -0
  31. data/{vendor/assets/leaflet.css.erb → lib/leaflet.draw/examples/libs/leaflet.css} +2 -2
  32. data/lib/leaflet.draw/package.json +40 -0
  33. data/lib/leaflet.draw/spec/after.js +2 -0
  34. data/lib/leaflet.draw/spec/before.js +3 -0
  35. data/lib/leaflet.draw/spec/expect.js +1253 -0
  36. data/lib/leaflet.draw/spec/happen.js +93 -0
  37. data/lib/leaflet.draw/spec/index.html +38 -0
  38. data/lib/leaflet.draw/spec/karma.conf.js +72 -0
  39. data/lib/leaflet.draw/spec/sinon.js +4223 -0
  40. data/lib/leaflet.draw/spec/spec.hintrc.js +25 -0
  41. data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +14 -0
  42. data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
  43. data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +11 -0
  44. data/lib/leaflet.draw/spec/suites/SpecHelper.js +28 -0
  45. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Control.Draw.js +9 -9
  46. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Leaflet.draw.js +1 -2
  47. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Toolbar.js +0 -0
  48. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Tooltip.js +0 -0
  49. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/copyright.js +0 -0
  50. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/DrawToolbar.js +0 -4
  51. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Circle.js +1 -1
  52. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Feature.js +2 -2
  53. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
  54. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polygon.js +0 -0
  55. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polyline.js +0 -0
  56. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Rectangle.js +1 -19
  57. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +1 -7
  58. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/EditToolbar.js +2 -9
  59. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
  60. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Poly.js +2 -14
  61. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Rectangle.js +0 -0
  62. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +3 -11
  63. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +1 -4
  64. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +83 -17
  65. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/GeometryUtil.js +1 -1
  66. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LatLngUtil.js +0 -0
  67. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
  68. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
  69. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polyline.Intersect.js +0 -0
  70. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/images/spritesheet.svg +0 -0
  71. data/lib/leaflet.label/CHANGELOG.md +67 -0
  72. data/lib/leaflet.label/Jakefile.js +21 -0
  73. data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
  74. data/lib/leaflet.label/README.md +103 -0
  75. data/lib/leaflet.label/build/build.js +155 -0
  76. data/lib/leaflet.label/build/deps.js +26 -0
  77. data/lib/leaflet.label/build/hint.js +30 -0
  78. data/lib/leaflet.label/build/hintrc.js +51 -0
  79. data/lib/leaflet.label/dist/images/death.png +0 -0
  80. data/lib/leaflet.label/dist/leaflet.label-src.js +542 -0
  81. data/{vendor/assets → lib/leaflet.label/dist}/leaflet.label.css +0 -0
  82. data/lib/leaflet.label/dist/leaflet.label.js +9 -0
  83. data/lib/leaflet.label/example/label.html +85 -0
  84. data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
  85. data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
  86. data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
  87. data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
  88. data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
  89. data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
  90. data/lib/leaflet.label/libs/leaflet/leaflet-src.js +9108 -0
  91. data/lib/leaflet.label/libs/leaflet/leaflet.css +478 -0
  92. data/lib/leaflet.label/libs/leaflet/leaflet.js +9 -0
  93. data/lib/leaflet.label/package.json +19 -0
  94. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/BaseMarkerMethods.js +0 -0
  95. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/CircleMarker.Label.js +0 -0
  96. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/FeatureGroup.Label.js +0 -0
  97. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Label.js +2 -5
  98. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Leaflet.label.js +1 -1
  99. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Map.Label.js +0 -0
  100. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Marker.Label.js +0 -0
  101. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Path.Label.js +0 -0
  102. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/copyright.js +0 -0
  103. data/lib/leaflet/CHANGELOG.md +1007 -0
  104. data/lib/leaflet/CONTRIBUTING.md +155 -0
  105. data/lib/leaflet/FAQ.md +138 -0
  106. data/lib/leaflet/Jakefile.js +56 -0
  107. data/lib/leaflet/LICENSE +23 -0
  108. data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
  109. data/lib/leaflet/README.md +34 -0
  110. data/lib/leaflet/build/build.html +227 -0
  111. data/lib/leaflet/build/build.js +190 -0
  112. data/lib/leaflet/build/deps.js +258 -0
  113. data/lib/leaflet/build/hintrc.js +40 -0
  114. data/lib/leaflet/debug/css/mobile.css +6 -0
  115. data/lib/leaflet/debug/css/screen.css +5 -0
  116. data/lib/leaflet/debug/hacks/jitter.html +42 -0
  117. data/lib/leaflet/debug/leaflet-include.js +59 -0
  118. data/lib/leaflet/debug/map/canvas.html +49 -0
  119. data/lib/leaflet/debug/map/controls.html +49 -0
  120. data/lib/leaflet/debug/map/geolocation.html +34 -0
  121. data/lib/leaflet/debug/map/grid.html +45 -0
  122. data/lib/leaflet/debug/map/iframe.html +11 -0
  123. data/lib/leaflet/debug/map/image-overlay.html +43 -0
  124. data/lib/leaflet/debug/map/map-mobile.html +34 -0
  125. data/lib/leaflet/debug/map/map.html +61 -0
  126. data/lib/leaflet/debug/map/max-bounds.html +38 -0
  127. data/lib/leaflet/debug/map/opacity.html +223 -0
  128. data/lib/leaflet/debug/map/scroll.html +41 -0
  129. data/lib/leaflet/debug/map/simple-proj.html +59 -0
  130. data/lib/leaflet/debug/map/wms-marble.html +30 -0
  131. data/lib/leaflet/debug/map/wms.html +40 -0
  132. data/lib/leaflet/debug/map/zoomlevels.html +45 -0
  133. data/lib/leaflet/debug/tests/add_remove_layers.html +87 -0
  134. data/lib/leaflet/debug/tests/bringtoback.html +37 -0
  135. data/lib/leaflet/debug/tests/canvasloop.html +47 -0
  136. data/lib/leaflet/debug/tests/click_on_canvas.html +58 -0
  137. data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
  138. data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
  139. data/lib/leaflet/debug/tests/opacity.html +56 -0
  140. data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
  141. data/lib/leaflet/debug/tests/remove_while_dragging.html +28 -0
  142. data/lib/leaflet/debug/tests/removetilewhilepan.html +41 -0
  143. data/lib/leaflet/debug/tests/reuse_popups.html +40 -0
  144. data/lib/leaflet/debug/tests/rtl.html +42 -0
  145. data/lib/leaflet/debug/tests/rtl2.html +27 -0
  146. data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
  147. data/lib/leaflet/debug/tests/svg_clicks.html +54 -0
  148. data/lib/leaflet/debug/vector/bounds-extend.html +88 -0
  149. data/lib/leaflet/debug/vector/feature-group-bounds.html +90 -0
  150. data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
  151. data/lib/leaflet/debug/vector/geojson.html +173 -0
  152. data/lib/leaflet/debug/vector/rectangle.html +53 -0
  153. data/lib/leaflet/debug/vector/route.js +1 -0
  154. data/lib/leaflet/debug/vector/touchzoomemu.html +194 -0
  155. data/lib/leaflet/debug/vector/us-states.js +54 -0
  156. data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
  157. data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
  158. data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
  159. data/lib/leaflet/debug/vector/vector-simple.html +47 -0
  160. data/lib/leaflet/debug/vector/vector.html +37 -0
  161. data/lib/leaflet/debug/vector/vector2.html +58 -0
  162. data/lib/leaflet/dist/images/layers-2x.png +0 -0
  163. data/lib/leaflet/dist/images/layers.png +0 -0
  164. data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
  165. data/lib/leaflet/dist/images/marker-icon.png +0 -0
  166. data/lib/leaflet/dist/images/marker-shadow.png +0 -0
  167. data/lib/leaflet/dist/leaflet.css +494 -0
  168. data/lib/leaflet/package.json +28 -0
  169. data/lib/leaflet/spec/after.js +2 -0
  170. data/lib/leaflet/spec/expect.js +1253 -0
  171. data/lib/leaflet/spec/index.html +87 -0
  172. data/lib/leaflet/spec/karma.conf.js +68 -0
  173. data/lib/leaflet/spec/sinon.js +4223 -0
  174. data/lib/leaflet/spec/spec.hintrc.js +25 -0
  175. data/lib/leaflet/spec/suites/SpecHelper.js +42 -0
  176. data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
  177. data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
  178. data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
  179. data/lib/leaflet/spec/suites/core/ClassSpec.js +166 -0
  180. data/lib/leaflet/spec/suites/core/EventsSpec.js +416 -0
  181. data/lib/leaflet/spec/suites/core/UtilSpec.js +237 -0
  182. data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
  183. data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
  184. data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
  185. data/lib/leaflet/spec/suites/geo/CRSSpec.js +151 -0
  186. data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +144 -0
  187. data/lib/leaflet/spec/suites/geo/LatLngSpec.js +102 -0
  188. data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +96 -0
  189. data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
  190. data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
  191. data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
  192. data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
  193. data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
  194. data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +86 -0
  195. data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +282 -0
  196. data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +71 -0
  197. data/lib/leaflet/spec/suites/layer/PopupSpec.js +119 -0
  198. data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +117 -0
  199. data/lib/leaflet/spec/suites/layer/tile/GridLayerSpec.js +70 -0
  200. data/lib/leaflet/spec/suites/layer/tile/TileLayerSpec.js +88 -0
  201. data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
  202. data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +18 -0
  203. data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +96 -0
  204. data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
  205. data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
  206. data/lib/leaflet/spec/suites/map/MapSpec.js +553 -0
  207. data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
  208. data/{vendor/assets/Leaflet → lib/leaflet}/src/Leaflet.js +16 -11
  209. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Attribution.js +1 -23
  210. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Layers.js +42 -57
  211. data/lib/leaflet/src/control/Control.Scale.js +102 -0
  212. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Zoom.js +11 -18
  213. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.js +7 -9
  214. data/lib/leaflet/src/copyright.js +4 -0
  215. data/lib/leaflet/src/core/Browser.js +65 -0
  216. data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Class.js +8 -13
  217. data/lib/leaflet/src/core/Events.js +226 -0
  218. data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Handler.js +0 -0
  219. data/lib/leaflet/src/core/Util.js +196 -0
  220. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.DoubleTap.js +20 -27
  221. data/lib/leaflet/src/dom/DomEvent.Pointer.js +107 -0
  222. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.js +70 -59
  223. data/lib/leaflet/src/dom/DomUtil.js +213 -0
  224. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/Draggable.js +10 -19
  225. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.Timer.js +0 -0
  226. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.js +4 -3
  227. data/lib/leaflet/src/geo/LatLng.js +67 -0
  228. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/LatLngBounds.js +0 -0
  229. data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
  230. data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
  231. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.EPSG4326.js +2 -3
  232. data/lib/leaflet/src/geo/crs/CRS.Earth.js +19 -0
  233. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.Simple.js +10 -1
  234. data/lib/leaflet/src/geo/crs/CRS.js +63 -0
  235. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/projection/Projection.LonLat.js +5 -1
  236. data/lib/leaflet/src/geo/projection/Projection.Mercator.js +43 -0
  237. data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +31 -0
  238. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Bounds.js +0 -0
  239. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/LineUtil.js +16 -5
  240. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Point.js +10 -0
  241. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/PolyUtil.js +0 -0
  242. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Transformation.js +0 -0
  243. data/{vendor/assets/Leaflet → lib/leaflet}/src/images/layers.svg +0 -0
  244. data/lib/leaflet/src/images/logo.svg +85 -0
  245. data/{vendor/assets/Leaflet → lib/leaflet}/src/images/marker.svg +0 -0
  246. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/FeatureGroup.js +3 -20
  247. data/lib/leaflet/src/layer/GeoJSON.js +275 -0
  248. data/lib/leaflet/src/layer/ImageOverlay.js +123 -0
  249. data/lib/leaflet/src/layer/Layer.Popup.js +87 -0
  250. data/lib/leaflet/src/layer/Layer.js +150 -0
  251. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/LayerGroup.js +12 -14
  252. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/Popup.js +65 -83
  253. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/DivIcon.js +3 -8
  254. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.Default.js +6 -12
  255. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.js +8 -25
  256. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.Drag.js +13 -11
  257. data/lib/leaflet/src/layer/marker/Marker.Popup.js +16 -0
  258. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.js +52 -103
  259. data/lib/leaflet/src/layer/tile/GridLayer.js +536 -0
  260. data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +79 -0
  261. data/lib/leaflet/src/layer/tile/TileLayer.js +148 -0
  262. data/lib/leaflet/src/layer/vector/Canvas.js +292 -0
  263. data/lib/leaflet/src/layer/vector/Circle.js +67 -0
  264. data/lib/leaflet/src/layer/vector/CircleMarker.js +72 -0
  265. data/lib/leaflet/src/layer/vector/Path.js +79 -0
  266. data/lib/leaflet/src/layer/vector/Polygon.js +75 -0
  267. data/lib/leaflet/src/layer/vector/Polyline.js +223 -0
  268. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/vector/Rectangle.js +27 -27
  269. data/lib/leaflet/src/layer/vector/Renderer.js +75 -0
  270. data/lib/leaflet/src/layer/vector/SVG.VML.js +134 -0
  271. data/lib/leaflet/src/layer/vector/SVG.js +189 -0
  272. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/Map.js +83 -199
  273. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
  274. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.ZoomAnimation.js +30 -38
  275. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/ext/Map.Geolocation.js +8 -8
  276. data/lib/leaflet/src/map/handler/Map.BoxZoom.js +105 -0
  277. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
  278. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Drag.js +12 -10
  279. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Keyboard.js +19 -17
  280. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.ScrollWheelZoom.js +10 -6
  281. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Tap.js +8 -6
  282. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.TouchZoom.js +16 -32
  283. data/vendor/assets/images/layers-2x.png +0 -0
  284. data/vendor/assets/images/layers.png +0 -0
  285. data/vendor/assets/images/marker-icon-2x.png +0 -0
  286. data/vendor/assets/images/marker-icon.png +0 -0
  287. data/vendor/assets/images/marker-shadow.png +0 -0
  288. data/vendor/assets/images/spritesheet-2x.png +0 -0
  289. data/vendor/assets/images/spritesheet.png +0 -0
  290. data/vendor/assets/{leaflet-js.js → javascripts/leaflet-js.js} +2 -2
  291. data/vendor/assets/javascripts/leaflet.draw.js +37 -0
  292. data/vendor/assets/javascripts/leaflet.js +149 -0
  293. data/vendor/assets/javascripts/leaflet.label.js +11 -0
  294. data/vendor/assets/{leaflet-js.css → stylesheets/leaflet-js.css} +0 -0
  295. data/vendor/assets/stylesheets/leaflet.css.erb +478 -0
  296. data/vendor/assets/{leaflet.draw.css.erb → stylesheets/leaflet.draw.css.erb} +2 -2
  297. data/vendor/assets/{leaflet.draw.ie.css → stylesheets/leaflet.draw.ie.css} +0 -0
  298. data/vendor/assets/stylesheets/leaflet.label.css +52 -0
  299. metadata +298 -137
  300. data/lib/leaflet-js/engine.rb +0 -7
  301. data/lib/leaflet-js/version.rb +0 -3
  302. data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +0 -75
  303. data/vendor/assets/Leaflet/src/control/Control.Scale.js +0 -112
  304. data/vendor/assets/Leaflet/src/copyright.js +0 -5
  305. data/vendor/assets/Leaflet/src/core/Browser.js +0 -66
  306. data/vendor/assets/Leaflet/src/core/Events.js +0 -178
  307. data/vendor/assets/Leaflet/src/core/Util.js +0 -182
  308. data/vendor/assets/Leaflet/src/dom/DomEvent.Pointer.js +0 -156
  309. data/vendor/assets/Leaflet/src/dom/DomUtil.js +0 -289
  310. data/vendor/assets/Leaflet/src/geo/LatLng.js +0 -99
  311. data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3395.js +0 -14
  312. data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3857.js +0 -21
  313. data/vendor/assets/Leaflet/src/geo/crs/CRS.js +0 -32
  314. data/vendor/assets/Leaflet/src/geo/projection/Projection.Mercator.js +0 -56
  315. data/vendor/assets/Leaflet/src/geo/projection/Projection.SphericalMercator.js +0 -27
  316. data/vendor/assets/Leaflet/src/geo/projection/Projection.js +0 -5
  317. data/vendor/assets/Leaflet/src/layer/GeoJSON.js +0 -286
  318. data/vendor/assets/Leaflet/src/layer/ImageOverlay.js +0 -141
  319. data/vendor/assets/Leaflet/src/layer/marker/Marker.Popup.js +0 -90
  320. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Anim.js +0 -110
  321. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Canvas.js +0 -61
  322. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.WMS.js +0 -87
  323. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.js +0 -597
  324. data/vendor/assets/Leaflet/src/layer/vector/Circle.js +0 -98
  325. data/vendor/assets/Leaflet/src/layer/vector/CircleMarker.js +0 -45
  326. data/vendor/assets/Leaflet/src/layer/vector/MultiPoly.js +0 -57
  327. data/vendor/assets/Leaflet/src/layer/vector/Path.Popup.js +0 -65
  328. data/vendor/assets/Leaflet/src/layer/vector/Path.SVG.js +0 -230
  329. data/vendor/assets/Leaflet/src/layer/vector/Path.VML.js +0 -135
  330. data/vendor/assets/Leaflet/src/layer/vector/Path.js +0 -119
  331. data/vendor/assets/Leaflet/src/layer/vector/Polygon.js +0 -92
  332. data/vendor/assets/Leaflet/src/layer/vector/Polyline.js +0 -164
  333. data/vendor/assets/Leaflet/src/layer/vector/canvas/Circle.Canvas.js +0 -18
  334. data/vendor/assets/Leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -9
  335. data/vendor/assets/Leaflet/src/layer/vector/canvas/Path.Canvas.js +0 -204
  336. data/vendor/assets/Leaflet/src/layer/vector/canvas/Polygon.Canvas.js +0 -37
  337. data/vendor/assets/Leaflet/src/layer/vector/canvas/Polyline.Canvas.js +0 -30
  338. data/vendor/assets/Leaflet/src/map/handler/Map.BoxZoom.js +0 -118
  339. data/vendor/assets/leaflet.draw.js +0 -38
  340. data/vendor/assets/leaflet.js +0 -155
  341. data/vendor/assets/leaflet.label.js +0 -11
@@ -0,0 +1,155 @@
1
+ Contributing to Leaflet
2
+ =======================
3
+
4
+ 1. [Getting Involved](#getting-involved)
5
+ 2. [Reporting Bugs](#reporting-bugs)
6
+ 3. [Contributing Code](#contributing-code)
7
+ 4. [Improving Documentation](#improving-documentation)
8
+
9
+ ## Getting Involved
10
+
11
+ Third-party patches are absolutely essential on our quest to create the best mapping library that will ever exist.
12
+ However, they're not the only way to get involved with the development of Leaflet.
13
+ You can help the project tremendously by discovering and [reporting bugs](#reporting-bugs),
14
+ [improving documentation](#improving-documentation),
15
+ helping others on the [Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js)
16
+ and [GitHub issues](https://github.com/Leaflet/Leaflet/issues),
17
+ showing your support for your favorite feature suggestions on [Leaflet UserVoice page](http://leaflet.uservoice.com),
18
+ tweeting to [@LeafletJS](http://twitter.com/LeafletJS)
19
+ and spreading the word about Leaflet among your colleagues and friends.
20
+
21
+ ## Reporting Bugs
22
+
23
+ Before reporting a bug on the project's [issues page](https://github.com/Leaflet/Leaflet/issues),
24
+ first make sure that your issue is caused by Leaflet, not your application code
25
+ (e.g. passing incorrect arguments to methods, etc.).
26
+ Second, search the already reported issues for similar cases,
27
+ and if it's already reported, just add any additional details in the comments.
28
+
29
+ After you made sure that you've found a new Leaflet bug,
30
+ here are some tips for creating a helpful report that will make fixing it much easier and quicker:
31
+
32
+ * Write a **descriptive, specific title**. Bad: *Problem with polylines*. Good: *Doing X in IE9 causes Z*.
33
+ * Include **browser, OS and Leaflet version** info in the description.
34
+ * Create a **simple test case** that demonstrates the bug (e.g. using [JSFiddle](http://jsfiddle.net/)).
35
+ * Check whether the bug can be reproduced in **other browsers**.
36
+ * Check if the bug occurs in the stable version, master, or both.
37
+ * *Bonus tip:* if the bug only appears in the master version but the stable version is fine,
38
+ use `git bisect` to find the exact commit that introduced the bug.
39
+
40
+ If you just want some help with your project,
41
+ try asking [on the Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js) instead.
42
+
43
+ ## Contributing Code
44
+
45
+ ### Considerations for Accepting Patches
46
+
47
+ While we happily accept patches, we're also commited to keeping Leaflet simple, lightweight and blazingly fast.
48
+ So bugfixes, performance optimizations and small improvements that don't add a lot of code
49
+ are much more likely to get accepted quickly.
50
+
51
+ Before sending a pull request with a new feature, first check if it's been discussed before already
52
+ (either on [GitHub issues](https://github.com/Leaflet/Leaflet/issues)
53
+ or [Leaflet UserVoice](http://leaflet.uservoice.com/)),
54
+ and then ask yourself two questions:
55
+
56
+ 1. Are you sure that this new feature is important enough to justify its presense in the Leaflet core?
57
+ Or will it look better as a plugin in a separate repository?
58
+ 2. Is it written in a simple, concise way that doesn't add bulk to the codebase?
59
+
60
+ If your feature or API improvement did get merged into master,
61
+ please consider submitting another pull request with the corresponding [documentation update](#improving-documentation).
62
+
63
+ ### Setting up the Build System
64
+
65
+ To set up the Leaflet build system, install [Node](http://nodejs.org/),
66
+ then run the following commands in the project root:
67
+
68
+ ```
69
+ npm install -g jake
70
+ npm install
71
+ ```
72
+
73
+ You can build minified Leaflet by running `jake` (it will be built from source in the `dist` folder).
74
+ For a custom build with selected components, open `build/build.html` in the browser and follow the instructions from there.
75
+
76
+ ### Making Changes to Leaflet Source
77
+
78
+ If you're not yet familiar with the way GitHub works (forking, pull requests, etc.),
79
+ be sure to check out the awesome [article about forking](https://help.github.com/articles/fork-a-repo)
80
+ on the GitHub Help website — it will get you started quickly.
81
+
82
+ You should always write each batch of changes (feature, bugfix, etc.) in **its own topic branch**.
83
+ Please do not commit to the `master` branch, or your unrelated changes will go into the same pull request.
84
+
85
+ You should also follow the code style and whitespace conventions of the original codebase.
86
+ In particular, use tabs for indentation and spaces for alignment.
87
+
88
+ Before commiting your changes, run `jake lint` to catch any JS errors in the code and fix them.
89
+ If you add any new files to the Leaflet source, make sure to also add them to `build/deps.js`
90
+ so that the build system knows about them.
91
+
92
+ Also, please make sure that you have [line endings configured properly](https://help.github.com/articles/dealing-with-line-endings) in Git! Otherwise the diff will show that all lines of a file were changed even if you touched only one.
93
+
94
+ Happy coding!
95
+
96
+ ## Running the Tests
97
+
98
+ To run the tests from the command line,
99
+ install [PhantomJS](http://phantomjs.org/) (and make sure it's in your `PATH`),
100
+ then run:
101
+
102
+ ```
103
+ jake test
104
+ ```
105
+
106
+ To run all the tests in actual browsers at the same time, you can do:
107
+
108
+ ```
109
+ jake test --ff --chrome --safari --ie
110
+ ```
111
+
112
+ To run the tests in a browser manually, open `spec/index.html`.
113
+
114
+ ## Code Coverage
115
+
116
+ To generate a detailed report about test coverage (which helps tremendously when working on test improvements), run:
117
+
118
+ ```
119
+ jake test --cov
120
+ ```
121
+
122
+ After that, open `spec/coverage/<environment>/index.html` in a browser to see the report.
123
+ From there you can click through folders/files to get details on their individual coverage.
124
+
125
+ ## Improving Documentation
126
+
127
+ The code of the live Leaflet website that contains all documentation and examples is located in the `gh-pages` branch
128
+ and is automatically generated from a set of HTML and Markdown files by [Jekyll](https://github.com/mojombo/jekyll).
129
+
130
+ The easiest way to make little improvements such as fixing typos without even leaving the browser
131
+ is by editing one of the files with the online GitHub editor:
132
+ browse the [gh-pages branch](https://github.com/Leaflet/Leaflet/tree/gh-pages),
133
+ choose a certain file for editing (e.g. `reference.html` for API reference),
134
+ click the Edit button, make changes and follow instructions from there.
135
+ Once it gets merged, the changes will immediately appear on the website.
136
+
137
+ If you need to make edits in a local repository to see how it looks in the process, do the following:
138
+
139
+ 1. [Install Ruby](http://www.ruby-lang.org/en/) if don't have it yet.
140
+ 2. Run `gem install jekyll`.
141
+ 3. Run `jekyll serve --watch` in the root `Leaflet` folder.
142
+ 4. Open `localhost:4000` in your browser.
143
+
144
+ Now any file changes will be updated when you reload pages automatically.
145
+ After commiting the changes, just send a pull request.
146
+
147
+ If you need to update documentation according to a new feature that only appeared in the master version (not stable one),
148
+ you need to make changes to `gh-pages-master` branch instead of `gh-pages`.
149
+ It will get merged into the latter when released as stable.
150
+
151
+ ## Thank You
152
+
153
+ Not only are we grateful for any contributions, &mdash; helping Leaflet and its community actually makes you AWESOME.
154
+ Join [this approved list of awesome people](https://github.com/Leaflet/Leaflet/graphs/contributors)
155
+ and help us push the limits of what's possible with online maps!
@@ -0,0 +1,138 @@
1
+ # Leaflet FAQ
2
+
3
+ This is a collection of answers to the most frequently asked questions about Leaflet.
4
+
5
+ 1. [Data Providers](#data-providers)
6
+ 2. [Commercial Use and Licensing](#commercial-use-and-licensing)
7
+ 3. [Features](#features)
8
+ 4. [Performance](#performance)
9
+ 5. [Misc](#misc)
10
+
11
+ ## Data Providers
12
+
13
+ #### The map is wrong in my neighborhood, could you fix it?
14
+
15
+ Nope, but you can.
16
+ The map you see on Leaflet examples is based on [OpenStreetMap](http://openstreetmap.org),
17
+ a free editable map of the world.
18
+ Signing up and editing the map there is easy,
19
+ and the changes will be reflected on the map in a few minutes.
20
+
21
+ #### What map tiles can I use with Leaflet? Is it limited to OpenStreetMap?
22
+
23
+ Leaflet is provider-agnostic, meaning you can use any map provider as long as you conform to its terms of use.
24
+ You can roll your own tiles as well.
25
+ [OpenStreetMap](http://openstreetmap.org) is the most popular data source among different tile providers,
26
+ but there are providers that use other sources.
27
+
28
+ Check out [this example](http://leaflet-extras.github.io/leaflet-providers/preview/)
29
+ with half a hundred different layers to choose from.
30
+ Popular commercial options, free up to a particular number of requests, include
31
+ [MapBox](http://mapbox.com),
32
+ [CloudMade](http://cloudmade.com),
33
+ [Bing Maps](http://www.microsoft.com/maps/choose-your-binge's-maps-API.aspx) (using a [plugin](https://github.com/shramov/leaflet-plugins)),
34
+ [Esri ArcGIS](http://www.arcgis.com/features/maps/imagery.html) ([official plugin](https://github.com/Esri/esri-leaflet))
35
+ and [Nokia Here](http://developer.here.com/web-experiences).
36
+ A notable exception is [MapQuest Open](http://developer.mapquest.com/web/products/open/map), which is free for any number of requests.
37
+
38
+ Always be sure to **read the terms of use** of a chosen tile provider, **know its limitations**, and **attribute it properly** in your app.
39
+
40
+ #### I'm looking for satellite imagery to use with my Leaflet map, any options?
41
+
42
+ [MapBox](http://mapbox.com),
43
+ [Bing Maps](http://www.microsoft.com/maps/choose-your-bing-maps-API.aspx),
44
+ [ArcGIS](http://www.arcgis.com/features/maps/imagery.html)
45
+ and [MapQuest Open](http://developer.mapquest.com/web/products/open/map) provide satellite imagery among others.
46
+
47
+ #### I want to use Google Maps API tiles with Leaflet, can I do that?
48
+
49
+ The problem with Google is that its [Terms of Use](https://developers.google.com/maps/terms?hl=ru) forbid any means of tile access other than through the Google Maps API.
50
+
51
+ You can add the Google Maps API as a Leaflet layer with a [plugin](https://github.com/shramov/leaflet-plugins). But note that the map experience will not be perfect, because Leaflet will just act as a proxy to the Google Maps JS engine, so you won't get all the performance and usability benefits of using Leaflet when the Google layer is on.
52
+
53
+ #### I want to roll my own OSM tile server for Leaflet, where do I start?
54
+
55
+ Check out [this excellent guide](http://switch2osm.org/serving-tiles/).
56
+
57
+ #### I want to create tiles from my own data for use with Leaflet, what are the options?
58
+
59
+ There's a number of services that allow you to do this easily,
60
+ notably [MapBox](https://www.mapbox.com/), [CartoDB](http://cartodb.com/) and [GIS Cloud](http://www.giscloud.com/).
61
+ If you want to make tiles on your own, probably the easiest way is using [TileMill](https://www.mapbox.com/tilemill/).
62
+ TileMill can export your map as a single [.mbtiles](https://www.mapbox.com/developers/mbtiles/) file, which can be copied to a webserver and accessed by Leaflet with [a small PHP script](https://github.com/infostreams/mbtiles-php).
63
+ Alternatively, you can [extract](https://github.com/mapbox/mbutil) the tiled images from the .mbtiles database and place them directly on your webserver with absolutely no server-side dependencies.
64
+
65
+ ## Commercial Use and Licensing
66
+
67
+ #### I have an app that gets lots of hits a day, and I want to switch from Google/Bing/whatever to Leaflet. Is there a fee for using it?
68
+
69
+ Leaflet, unlike Google Maps and other all-in-one solutions, is just a JavaScript library.
70
+ It's free to use, but doesn't provide map imagery on its own &mdash;
71
+ you have to choose a tile service to combine with it.
72
+
73
+ There are [plenty of options](#what-map-tiles-can-i-use-with-leaflet-is-it-limited-to-openstreetmap) for a tile service,
74
+ each with their own terms of use, prices (some of them free), features, limitations, etc.
75
+ Choice is yours.
76
+
77
+ #### I'm building a commercial app that I plan to sell. Can I use Leaflet in it?
78
+
79
+ You're welcome, as the code is published under the very permissive [2-clause BSD License](https://github.com/Leaflet/Leaflet/blob/master/LICENSE).
80
+ Just make sure to attribute the use of the library somewhere in the app UI or the distribution
81
+ (e.g. keep the Leaflet link on the map, or mention the use on the About page or a Readme file, etc.) and you'll be fine.
82
+
83
+ That only applies to the code though.
84
+ Make sure you conform to the terms of use of the tile images provider(s) that you choose as well.
85
+
86
+
87
+ ## Features
88
+
89
+ #### Why is there still no feature X in Leaflet?
90
+
91
+ First of all, did you check out the [Leaflet plugins page](http://leafletjs.com/plugins.html)?
92
+ It lists about a hundred plugins doing all kinds of crazy stuff,
93
+ and there's a high possibility that it has what you're looking for.
94
+
95
+ Generally, we do our best to keep the Leaflet core small, lightweight and simple,
96
+ focusing on _quality_ instead of _quantity_, and leaving all the rest to plugin authors.
97
+
98
+ Check out [this video](http://www.youtube.com/watch?v=_P2SaCPbJ4w) of a talk by the Leaflet creator for more background on the story and philosophy behind Leaflet.
99
+ Another essential read is [Advocating Simplicity in Open Source](http://blog.universalmind.com/advocating-simplicity-in-open-source/) by the same guy.
100
+
101
+
102
+ ## Performance
103
+
104
+ #### I have thousands of markers on my map. How do I make it faster and more usable?
105
+
106
+ Check out the [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) plugin. It's amazing.
107
+
108
+ #### I have vector data with many thousands of points on my map. Any performance tips?
109
+
110
+ Leaflet generally does a pretty good job of handling heavy vector data
111
+ with its real-time clipping and simplification algorithms,
112
+ but browser technology still has its limits.
113
+ Try [switching from SVG to Canvas as the default rendering back-end](http://leafletjs.com/reference.html#global),
114
+ it may help considerably (depends on the app and the data).
115
+
116
+ If you still have too much data to render, you'll have to use some help of a server-side service
117
+ like [MapBox](https://www.mapbox.com/),
118
+ [CartoDB](http://cartodb.com/)
119
+ and [GIS Cloud](http://www.giscloud.com/)
120
+ (they all work great with Leaflet).
121
+ What they do under the hood is serving rendered data as image tiles,
122
+ along with additional data to enable interactivity like hovering shapes
123
+ (e.g. done using [UTFGrid](https://www.mapbox.com/developers/utfgrid/) &mdash;
124
+ Leaflet [has a nice plugin](https://github.com/danzel/Leaflet.utfgrid) for it).
125
+
126
+
127
+ ## Misc
128
+
129
+ #### I downloaded the Leaflet source but didn't find `leaflet.js` there. Why is that?
130
+
131
+ You can download the built versions using links from the [download page](http://leafletjs.com/download.html).
132
+ It even includes the latest build of the development version (`master` branch),
133
+ updated automatically on each commit to the repo.
134
+
135
+ We removed the built versions from the repository because it's a chore to build and commit them manually on each change,
136
+ and it often complicates merging branches and managing contributions.
137
+
138
+ There's a common complaint that Leaflet can't be used with [Bower](http://bower.io/) because of that, but we'll resolve the issue soon.
@@ -0,0 +1,56 @@
1
+ /*
2
+ Leaflet building, testing and linting scripts.
3
+
4
+ To use, install Node, then run the following commands in the project root:
5
+
6
+ npm install -g jake
7
+ npm install
8
+
9
+ To check the code for errors and build Leaflet from source, run "jake".
10
+ To run the tests, run "jake test".
11
+
12
+ For a custom build, open build/build.html in the browser and follow the instructions.
13
+ */
14
+
15
+ var build = require('./build/build.js'),
16
+ version = require('./src/Leaflet.js').version;
17
+
18
+ function hint(msg, paths) {
19
+ return function () {
20
+ console.log(msg);
21
+ jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
22
+ {printStdout: true}, function () {
23
+ console.log('\tCheck passed.\n');
24
+ complete();
25
+ });
26
+ }
27
+ }
28
+
29
+ desc('Check Leaflet source for errors with JSHint');
30
+ task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
31
+
32
+ desc('Check Leaflet specs source for errors with JSHint');
33
+ task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
34
+
35
+ desc('Combine and compress Leaflet source files');
36
+ task('build', {async: true}, function (compsBase32, buildName) {
37
+ var v;
38
+
39
+ jake.exec('git log -1 --pretty=format:"%h"', {}, function () {
40
+ build.build(complete, v, compsBase32, buildName);
41
+
42
+ }).on('stdout', function (data) {
43
+ v = version + ' (' + data.toString() + ')';
44
+ })
45
+ });
46
+
47
+ desc('Run PhantomJS tests');
48
+ task('test', ['lint', 'lintspec'], {async: true}, function () {
49
+ build.test(complete);
50
+ });
51
+
52
+ task('default', ['test', 'build']);
53
+
54
+ jake.addListener('complete', function () {
55
+ process.exit();
56
+ });
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2010-2014, Vladimir Agafonkin
2
+ Copyright (c) 2010-2011, CloudMade
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are
6
+ permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this list of
9
+ conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
12
+ of conditions and the following disclaimer in the documentation and/or other materials
13
+ provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
16
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18
+ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
22
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,127 @@
1
+ # Leaflet Plugin Authoring Guide
2
+
3
+ One of the greatest things about Leaflet is its powerful plugin ecosystem.
4
+ The [Leaflet plugins page](http://leafletjs.com/plugins.html) lists dozens of awesome plugins, and more are being added every week.
5
+
6
+ This guide lists a number of best practices for publishing a Leaflet plugin that meets the quality standards of Leaflet itself.
7
+
8
+ 1. [Presentation](#presentation)
9
+ - [Repository](#repository)
10
+ - [Name](#name)
11
+ - [Demo](#demo)
12
+ - [Readme](#readme)
13
+ - [License](#license)
14
+ 2. [Code](#code)
15
+ - [File Structure](#file-structure)
16
+ - [Code Conventions](#code-conventions)
17
+ - [Plugin API](#plugin-api)
18
+
19
+ ## Presentation
20
+
21
+ ### Repository
22
+
23
+ The best place to put your Leaflet plugin to is a separate [GitHub](http://github.com) repository.
24
+ If you create a collection of plugins for different uses,
25
+ don't put them in one repo &mdash;
26
+ it's usually easier to work with small, self-contained plugins in individual repositories.
27
+
28
+ ### Name
29
+
30
+ Most existing plugins follow the convention of naming plugins (and repos) like this: `Leaflet.MyPluginName`.
31
+ You can use other forms (e.g. "leaflet-my-plugin-name"),
32
+ just make sure to include the word "Leaflet" in the name so that it's obvious that it's a Leaflet plugin.
33
+
34
+ ### Demo
35
+
36
+ The most essential thing to do when publishing a plugin is to include a demo that showcases what the plugin does &mdash;
37
+ it's usually the first thing people will look for.
38
+
39
+ The easiest way to put up a demo is using [GitHub Pages](http://pages.github.com/).
40
+ A good [starting point](https://help.github.com/articles/creating-project-pages-manually) is creating a `gh-pages` branch in your repo and adding an `index.html` page to it &mdash;
41
+ after pushing, it'll be published as `http://<user>.github.io/<repo>`.
42
+
43
+ ### Readme
44
+
45
+ The next thing you need to have is a descriptive `README.md` in the root of the repo (or a link to a website with a similar content).
46
+ At a minimum it should contain the following items:
47
+
48
+ - name of the plugin
49
+ - a simple, concise description of what it does
50
+ - requirements
51
+ - Leaflet version
52
+ - other external dependencies (if any)
53
+ - browser / device compatibility
54
+ - links to demos
55
+ - instructions for including the plugin
56
+ - simple usage code example
57
+ - API reference (methods, options, events)
58
+
59
+ ### License
60
+
61
+ Every open source repository should include a license.
62
+ If you don't know what open source license to choose for your code,
63
+ [MIT License](http://opensource.org/licenses/MIT) and [BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause) are both good choices.
64
+ You can either put it in the repo as a `LICENSE` file or just link to the license from the Readme.
65
+
66
+ ## Code
67
+
68
+ ### File Structure
69
+
70
+ Keep the file structure clean and simple,
71
+ don't pile up lots of files in one place &mdash;
72
+ make it easy for a new person to find their way in your repo.
73
+
74
+ A barebones repo for a simple plugin would look like this:
75
+
76
+ ```
77
+ my-plugin.js
78
+ README.md
79
+ ```
80
+
81
+ An example of a more sophisticated plugin file structure:
82
+
83
+ ```
84
+ /src - JS source files
85
+ /dist - minified plugin JS, CSS, images
86
+ /spec - test files
87
+ /lib - any external libraries/plugins if necessary
88
+ /examples - HTML examples of plugin usage
89
+ README.md
90
+ LICENSE
91
+ package.json
92
+ ```
93
+
94
+ ### Code Conventions
95
+
96
+ Everyone's tastes are different, but it's important to be consistent with whatever conventions you choose for your plugin.
97
+
98
+ For a good starting point, check out [Airbnb JavaScript Guide](https://github.com/airbnb/javascript).
99
+ Leaflet follows pretty much the same conventions
100
+ except for using smart tabs (hard tabs for indentation, spaces for alignment)
101
+ and putting a space after the `function` keyword.
102
+
103
+ ### Plugin API
104
+
105
+ Never expose global variables in your plugin.<br>
106
+ If you have a new class, put it directly in the `L` namespace (`L.MyPlugin`).<br>
107
+ If you inherit one of the existing classes, make it a sub-property (`L.TileLayer.Banana`).<br>
108
+ If you want to add new methods to existing Leaflet classes, you can do it like this: `L.Marker.include({myPlugin: …})`.
109
+
110
+ Function, method and property names should be in `camelCase`.<br>
111
+ Class names should be in `CapitalizedCamelCase`.
112
+
113
+ If you have a lot of arguments in your function, consider accepting an options object instead
114
+ (putting default values where possible so that users don't need specify all of them):
115
+
116
+ ```js
117
+ // bad
118
+ marker.myPlugin('bla', 'foo', null, {}, 5, 0);
119
+
120
+ // good
121
+ marker.myPlugin('bla', {
122
+ optionOne: 'foo',
123
+ optionThree: 5
124
+ });
125
+ ```
126
+
127
+ And most importantly, keep it simple. Leaflet is all about *simplicity*.