leaflet-js 0.6.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +15 -0
  2. data/CHANGELOG.rdoc +32 -0
  3. data/LICENSE +21 -0
  4. data/README.rdoc +54 -0
  5. data/Rakefile +15 -0
  6. data/leaflet-js.gemspec +28 -0
  7. data/lib/leaflet-js.rb +10 -0
  8. data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
  9. data/lib/leaflet.draw/CHANGELOG.md +73 -0
  10. data/lib/leaflet.draw/Jakefile.js +26 -0
  11. data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
  12. data/lib/leaflet.draw/README.md +364 -0
  13. data/lib/leaflet.draw/TODO.md +62 -0
  14. data/lib/leaflet.draw/build/build.html +243 -0
  15. data/lib/leaflet.draw/build/build.js +189 -0
  16. data/lib/leaflet.draw/build/deps.js +75 -0
  17. data/lib/leaflet.draw/build/hintrc.js +47 -0
  18. data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
  19. data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
  20. data/lib/leaflet.draw/dist/leaflet.draw-src.js +2429 -0
  21. data/lib/leaflet.draw/dist/leaflet.draw.css +212 -0
  22. data/lib/leaflet.draw/dist/leaflet.draw.ie.css +44 -0
  23. data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
  24. data/lib/leaflet.draw/examples/basic.html +106 -0
  25. data/lib/leaflet.draw/examples/edithandlers.html +67 -0
  26. data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
  27. data/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/lib/leaflet.draw/examples/libs/images/marker-shadow.png +0 -0
  30. data/lib/leaflet.draw/examples/libs/leaflet-src.js +8587 -0
  31. data/lib/leaflet.draw/examples/libs/leaflet.css +459 -0
  32. data/lib/leaflet.draw/examples/libs/leaflet.ie.css +51 -0
  33. data/lib/leaflet.draw/package.json +37 -0
  34. data/lib/leaflet.draw/spec/after.js +2 -0
  35. data/lib/leaflet.draw/spec/before.js +3 -0
  36. data/lib/leaflet.draw/spec/expect.js +1253 -0
  37. data/lib/leaflet.draw/spec/happen.js +93 -0
  38. data/lib/leaflet.draw/spec/index.html +36 -0
  39. data/lib/leaflet.draw/spec/karma.conf.js +69 -0
  40. data/lib/leaflet.draw/spec/sinon.js +4223 -0
  41. data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +15 -0
  42. data/lib/leaflet.draw/spec/suites/SpecHelper.js +26 -0
  43. data/lib/leaflet.draw/src/Control.Draw.js +101 -0
  44. data/lib/leaflet.draw/src/Leaflet.draw.js +5 -0
  45. data/lib/leaflet.draw/src/Toolbar.js +187 -0
  46. data/lib/leaflet.draw/src/Tooltip.js +52 -0
  47. data/lib/leaflet.draw/src/copyright.js +8 -0
  48. data/lib/leaflet.draw/src/draw/DrawToolbar.js +107 -0
  49. data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +59 -0
  50. data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +74 -0
  51. data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +97 -0
  52. data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +79 -0
  53. data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +360 -0
  54. data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +41 -0
  55. data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +67 -0
  56. data/lib/leaflet.draw/src/edit/EditToolbar.js +93 -0
  57. data/lib/leaflet.draw/src/edit/handler/Edit.Circle.js +63 -0
  58. data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +267 -0
  59. data/lib/leaflet.draw/src/edit/handler/Edit.Rectangle.js +117 -0
  60. data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +138 -0
  61. data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +109 -0
  62. data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +233 -0
  63. data/lib/leaflet.draw/src/ext/LatLngUtil.js +18 -0
  64. data/lib/leaflet.draw/src/ext/LineUtil.Intersect.js +15 -0
  65. data/lib/leaflet.draw/src/ext/Polygon.Intersect.js +27 -0
  66. data/lib/leaflet.draw/src/ext/Polyline.Intersect.js +85 -0
  67. data/lib/leaflet.label/CHANGELOG.md +35 -0
  68. data/lib/leaflet.label/Jakefile.js +21 -0
  69. data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
  70. data/lib/leaflet.label/README.md +86 -0
  71. data/lib/leaflet.label/build/build.js +155 -0
  72. data/lib/leaflet.label/build/deps.js +24 -0
  73. data/lib/leaflet.label/build/hint.js +30 -0
  74. data/lib/leaflet.label/build/hintrc.js +47 -0
  75. data/lib/leaflet.label/dist/images/death.png +0 -0
  76. data/lib/leaflet.label/dist/leaflet.label-src.js +359 -0
  77. data/lib/leaflet.label/dist/leaflet.label.css +33 -0
  78. data/lib/leaflet.label/dist/leaflet.label.js +9 -0
  79. data/lib/leaflet.label/example/label.html +82 -0
  80. data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
  81. data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
  82. data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
  83. data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
  84. data/lib/leaflet.label/libs/leaflet/leaflet-src.js +8587 -0
  85. data/lib/leaflet.label/libs/leaflet/leaflet.css +459 -0
  86. data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +51 -0
  87. data/lib/leaflet.label/libs/leaflet/leaflet.js +8 -0
  88. data/lib/leaflet.label/src/FeatureGroup.Label.js +20 -0
  89. data/lib/leaflet.label/src/Label.js +123 -0
  90. data/lib/leaflet.label/src/Leaflet.label.js +5 -0
  91. data/lib/leaflet.label/src/Map.Label.js +7 -0
  92. data/lib/leaflet.label/src/Marker.Label.js +160 -0
  93. data/lib/leaflet.label/src/Path.Label.js +55 -0
  94. data/lib/leaflet.label/src/copyright.js +8 -0
  95. data/lib/leaflet/CHANGELOG.md +637 -0
  96. data/lib/leaflet/CONTRIBUTING.md +155 -0
  97. data/lib/leaflet/Jakefile.js +26 -0
  98. data/lib/leaflet/LICENSE +23 -0
  99. data/lib/leaflet/README.md +30 -0
  100. data/lib/leaflet/build/build.html +243 -0
  101. data/lib/leaflet/build/build.js +193 -0
  102. data/lib/leaflet/build/deps.js +256 -0
  103. data/lib/leaflet/build/hintrc.js +37 -0
  104. data/lib/leaflet/debug/css/mobile.css +6 -0
  105. data/lib/leaflet/debug/css/screen.css +5 -0
  106. data/lib/leaflet/debug/hacks/jitter.html +43 -0
  107. data/lib/leaflet/debug/leaflet-include.js +59 -0
  108. data/lib/leaflet/debug/map/canvas.html +47 -0
  109. data/lib/leaflet/debug/map/controls.html +50 -0
  110. data/lib/leaflet/debug/map/geolocation.html +35 -0
  111. data/lib/leaflet/debug/map/image-overlay.html +44 -0
  112. data/lib/leaflet/debug/map/map-mobile.html +35 -0
  113. data/lib/leaflet/debug/map/map.html +60 -0
  114. data/lib/leaflet/debug/map/max-bounds.html +37 -0
  115. data/lib/leaflet/debug/map/scroll.html +36 -0
  116. data/lib/leaflet/debug/map/simple-proj.html +45 -0
  117. data/lib/leaflet/debug/map/wms-marble.html +31 -0
  118. data/lib/leaflet/debug/map/wms.html +41 -0
  119. data/lib/leaflet/debug/map/zoomlevels.html +46 -0
  120. data/lib/leaflet/debug/tests/add_remove_layers.html +88 -0
  121. data/lib/leaflet/debug/tests/bringtoback.html +38 -0
  122. data/lib/leaflet/debug/tests/click_on_canvas.html +59 -0
  123. data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
  124. data/lib/leaflet/debug/tests/opacity.html +57 -0
  125. data/lib/leaflet/debug/tests/remove_while_dragging.html +29 -0
  126. data/lib/leaflet/debug/tests/removetilewhilepan.html +42 -0
  127. data/lib/leaflet/debug/tests/reuse_popups.html +41 -0
  128. data/lib/leaflet/debug/tests/svg_clicks.html +55 -0
  129. data/lib/leaflet/debug/vector/bounds-extend.html +89 -0
  130. data/lib/leaflet/debug/vector/feature-group-bounds.html +91 -0
  131. data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
  132. data/lib/leaflet/debug/vector/geojson.html +174 -0
  133. data/lib/leaflet/debug/vector/rectangle.html +54 -0
  134. data/lib/leaflet/debug/vector/route.js +1 -0
  135. data/lib/leaflet/debug/vector/touchzoomemu.html +195 -0
  136. data/lib/leaflet/debug/vector/us-states.js +54 -0
  137. data/lib/leaflet/debug/vector/vector-bounds.html +70 -0
  138. data/lib/leaflet/debug/vector/vector-canvas.html +93 -0
  139. data/lib/leaflet/debug/vector/vector-mobile.html +39 -0
  140. data/lib/leaflet/debug/vector/vector-simple.html +49 -0
  141. data/lib/leaflet/debug/vector/vector.html +38 -0
  142. data/lib/leaflet/dist/images/layers.png +0 -0
  143. data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
  144. data/lib/leaflet/dist/images/marker-icon.png +0 -0
  145. data/lib/leaflet/dist/images/marker-shadow.png +0 -0
  146. data/lib/leaflet/dist/leaflet-src.js +8579 -0
  147. data/lib/leaflet/dist/leaflet.css +459 -0
  148. data/lib/leaflet/dist/leaflet.ie.css +51 -0
  149. data/lib/leaflet/dist/leaflet.js +8 -0
  150. data/lib/leaflet/package.json +22 -0
  151. data/lib/leaflet/spec/after.js +2 -0
  152. data/lib/leaflet/spec/before.js +3 -0
  153. data/lib/leaflet/spec/expect.js +1253 -0
  154. data/lib/leaflet/spec/happen.js +93 -0
  155. data/lib/leaflet/spec/index.html +78 -0
  156. data/lib/leaflet/spec/karma.conf.js +64 -0
  157. data/lib/leaflet/spec/sinon.js +4223 -0
  158. data/lib/leaflet/spec/suites/LeafletSpec.js +13 -0
  159. data/lib/leaflet/spec/suites/SpecHelper.js +26 -0
  160. data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
  161. data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
  162. data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
  163. data/lib/leaflet/spec/suites/core/ClassSpec.js +156 -0
  164. data/lib/leaflet/spec/suites/core/EventsSpec.js +336 -0
  165. data/lib/leaflet/spec/suites/core/UtilSpec.js +212 -0
  166. data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
  167. data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +89 -0
  168. data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +136 -0
  169. data/lib/leaflet/spec/suites/geo/LatLngSpec.js +118 -0
  170. data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +47 -0
  171. data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
  172. data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
  173. data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
  174. data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
  175. data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
  176. data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +36 -0
  177. data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +86 -0
  178. data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +58 -0
  179. data/lib/leaflet/spec/suites/layer/PopupSpec.js +59 -0
  180. data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +87 -0
  181. data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
  182. data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +17 -0
  183. data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +55 -0
  184. data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
  185. data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
  186. data/lib/leaflet/spec/suites/map/MapSpec.js +244 -0
  187. data/lib/leaflet/src/Leaflet.js +23 -0
  188. data/lib/leaflet/src/control/Control.Attribution.js +115 -0
  189. data/lib/leaflet/src/control/Control.Layers.js +243 -0
  190. data/lib/leaflet/src/control/Control.Scale.js +112 -0
  191. data/lib/leaflet/src/control/Control.Zoom.js +86 -0
  192. data/lib/leaflet/src/control/Control.js +107 -0
  193. data/lib/leaflet/src/copyright.js +4 -0
  194. data/lib/leaflet/src/core/Browser.js +96 -0
  195. data/lib/leaflet/src/core/Class.js +106 -0
  196. data/lib/leaflet/src/core/Events.js +174 -0
  197. data/lib/leaflet/src/core/Handler.js +28 -0
  198. data/lib/leaflet/src/core/Util.js +182 -0
  199. data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +103 -0
  200. data/lib/leaflet/src/dom/DomEvent.MsTouch.js +146 -0
  201. data/lib/leaflet/src/dom/DomEvent.js +211 -0
  202. data/lib/leaflet/src/dom/DomUtil.js +239 -0
  203. data/lib/leaflet/src/dom/Draggable.js +198 -0
  204. data/lib/leaflet/src/dom/PosAnimation.Timer.js +67 -0
  205. data/lib/leaflet/src/dom/PosAnimation.js +83 -0
  206. data/lib/leaflet/src/geo/LatLng.js +88 -0
  207. data/lib/leaflet/src/geo/LatLngBounds.js +153 -0
  208. data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +14 -0
  209. data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +21 -0
  210. data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +10 -0
  211. data/lib/leaflet/src/geo/crs/CRS.Simple.js +12 -0
  212. data/lib/leaflet/src/geo/crs/CRS.js +27 -0
  213. data/lib/leaflet/src/geo/projection/Projection.LonLat.js +13 -0
  214. data/lib/leaflet/src/geo/projection/Projection.Mercator.js +56 -0
  215. data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +27 -0
  216. data/lib/leaflet/src/geo/projection/Projection.js +5 -0
  217. data/lib/leaflet/src/geometry/Bounds.js +95 -0
  218. data/lib/leaflet/src/geometry/LineUtil.js +202 -0
  219. data/lib/leaflet/src/geometry/Point.js +119 -0
  220. data/lib/leaflet/src/geometry/PolyUtil.js +55 -0
  221. data/lib/leaflet/src/geometry/Transformation.js +31 -0
  222. data/lib/leaflet/src/images/marker.svg +1 -0
  223. data/lib/leaflet/src/layer/FeatureGroup.js +81 -0
  224. data/lib/leaflet/src/layer/GeoJSON.js +245 -0
  225. data/lib/leaflet/src/layer/ImageOverlay.js +132 -0
  226. data/lib/leaflet/src/layer/LayerGroup.js +110 -0
  227. data/lib/leaflet/src/layer/Popup.js +316 -0
  228. data/lib/leaflet/src/layer/marker/DivIcon.js +43 -0
  229. data/lib/leaflet/src/layer/marker/Icon.Default.js +51 -0
  230. data/lib/leaflet/src/layer/marker/Icon.js +101 -0
  231. data/lib/leaflet/src/layer/marker/Marker.Drag.js +66 -0
  232. data/lib/leaflet/src/layer/marker/Marker.Popup.js +72 -0
  233. data/lib/leaflet/src/layer/marker/Marker.js +275 -0
  234. data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +117 -0
  235. data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +60 -0
  236. data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +83 -0
  237. data/lib/leaflet/src/layer/tile/TileLayer.js +578 -0
  238. data/lib/leaflet/src/layer/vector/Circle.js +98 -0
  239. data/lib/leaflet/src/layer/vector/CircleMarker.js +33 -0
  240. data/lib/leaflet/src/layer/vector/MultiPoly.js +47 -0
  241. data/lib/leaflet/src/layer/vector/Path.Popup.js +65 -0
  242. data/lib/leaflet/src/layer/vector/Path.SVG.js +219 -0
  243. data/lib/leaflet/src/layer/vector/Path.VML.js +125 -0
  244. data/lib/leaflet/src/layer/vector/Path.js +115 -0
  245. data/lib/leaflet/src/layer/vector/Polygon.js +81 -0
  246. data/lib/leaflet/src/layer/vector/Polyline.js +164 -0
  247. data/lib/leaflet/src/layer/vector/Rectangle.js +27 -0
  248. data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
  249. data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +196 -0
  250. data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +37 -0
  251. data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +30 -0
  252. data/lib/leaflet/src/map/Map.js +743 -0
  253. data/lib/leaflet/src/map/anim/Map.PanAnimation.js +88 -0
  254. data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +90 -0
  255. data/lib/leaflet/src/map/ext/Map.Geolocation.js +91 -0
  256. data/lib/leaflet/src/map/handler/Map.BoxZoom.js +104 -0
  257. data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +23 -0
  258. data/lib/leaflet/src/map/handler/Map.Drag.js +146 -0
  259. data/lib/leaflet/src/map/handler/Map.Keyboard.js +147 -0
  260. data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +56 -0
  261. data/lib/leaflet/src/map/handler/Map.TouchZoom.js +121 -0
  262. data/vendor/assets/images/layers.png +0 -0
  263. data/vendor/assets/images/marker-icon-2x.png +0 -0
  264. data/vendor/assets/images/marker-icon.png +0 -0
  265. data/vendor/assets/images/marker-shadow.png +0 -0
  266. data/vendor/assets/images/spritesheet.png +0 -0
  267. data/vendor/assets/javascripts/leaflet.draw.js +39 -0
  268. data/vendor/assets/javascripts/leaflet.js +145 -0
  269. data/vendor/assets/javascripts/leaflet.label.js +9 -0
  270. data/vendor/assets/stylesheets/leaflet.css.erb +459 -0
  271. data/vendor/assets/stylesheets/leaflet.draw.css.erb +212 -0
  272. data/vendor/assets/stylesheets/leaflet.draw.ie.css +44 -0
  273. data/vendor/assets/stylesheets/leaflet.ie.css +51 -0
  274. data/vendor/assets/stylesheets/leaflet.label.css +33 -0
  275. metadata +317 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDc5OWQ2N2Q2OWIxNDE2YWI0YzA3ZjQzMDE3MzE0ZjkyZWY3YjVlYg==
5
+ data.tar.gz: !binary |-
6
+ YWJmZGZkOGRhMTAyYTYxMjQyYmM3ZjE1ODVhYzAwNzYwZmUwYWYyOQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWZkY2UyYzJkNWJkNDFlOWNiZDE0MWFiYTliNDM2NzA0NmY0ZTUwNDRlNjJh
10
+ MGZlOTgyNjQyNTcwMDA0MTQwNTJhMDQyNGZiNWJkZWRkNjJiYjI5ZjQzYTVi
11
+ ZDEwMWExODYxYTIxNzBiODNjYTRjZDRhODc5ZDUwNTgwY2FlOTQ=
12
+ data.tar.gz: !binary |-
13
+ ZDI0OTgwOGIwOGY1ZTc4MTFlYjZkZmQ4MTQ4ZmRiM2E1ZGQ4NWUzZGFiMDYx
14
+ NjNhYTA1YzI1NDdjOWNkMzk3ZGI5NTNlMTgwODFhZjdhZDdjNzVjYTNiMGNk
15
+ MWU5ZWY4MmNkNzk3ZjczNTc0ZDg0ZTAyMzA3YjgzZWJmNjQ4MmY=
@@ -0,0 +1,32 @@
1
+ = leaflet-js Changelog
2
+
3
+ === 0.6.beta4 (May 2, 2013)
4
+ * Unix is case senstive!
5
+
6
+ === 0.6.beta2 (April 30, 2013)
7
+ * Update to latest version of leaflet (0.6 master)
8
+ * Add in leaflet label
9
+ * Add in leaflet draw
10
+
11
+ === 0.6.beta1 (April 30, 2013)
12
+ * Update to latest version of leaflet (0.6 master)
13
+ * Add in leaflet label
14
+ * Add in leaflet draw
15
+
16
+ === 0.4.beta1 (May 6, 2012)
17
+ * Update to latest version of leaflet (0.4 master)
18
+
19
+ === 0.3.beta4 (February 3, 2012)
20
+ * Copy images to vendor/assets/images so they are precompiled correctly.
21
+ * Copy stylesheets to vendor/assets/stylesheets and then update.
22
+ * Modify stylesheets to use asset_path for background images so that
23
+ precompiling works correctly.
24
+
25
+ === 0.3.beta3 (January 17, 2012)
26
+ * Remove zerista_layer.js to remove depedency on jQuery.
27
+
28
+ === 0.3.beta2 (January 17, 2012)
29
+ * Withdrawn
30
+
31
+ === 0.3.beta1 (January 16, 2012)
32
+ * First release, wraps the current master version of Leaflet 0.3 which is not yet released.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2008-2011 Charlie Savage and contributors
2
+ Copyright (c) 2002-2007 Sean Chittenden and contributors
3
+ Copyright (c) 2001 Wai-Sun "Squidster" Chia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,54 @@
1
+ = Leaflet JS Rails
2
+
3
+ == Overview
4
+ leaflet-js wraps the Leaflet Javascript library in an asset gem so it can
5
+ easily be used with Rails. It also includes the Leaflet.Label and Leaflet.Draw
6
+ plusins. For more information about the Leaflet library, please visit http://leafletjs.com.
7
+
8
+ == Installation
9
+
10
+ In your Gemfile, add this line:
11
+
12
+ gem "leaflet-js"
13
+
14
+ Then, run bundle install. You're done!
15
+
16
+ == Usage
17
+
18
+ Leaflet provides javascript, css and image assets. To use these assets in your project, either
19
+ require the files below from your erb files or add them to your top level application.js and css files.
20
+
21
+ Leaflet provides the following assets:
22
+
23
+ === Javascripts
24
+
25
+ leaflet.js
26
+ leaflet.draw.js
27
+ leaflet.label.js
28
+
29
+ === Stylesheets
30
+
31
+ leaflet.css
32
+ leaflet.ie.css
33
+ leaflet.draw.css
34
+ leaflet.draw.ie.css
35
+ leaflet.label.css
36
+
37
+ === Images
38
+
39
+ layers.png
40
+ marker-icon.png
41
+ marker-icon@2x.png
42
+ market-shadow.png
43
+ spritesheet.png
44
+
45
+ == Support
46
+
47
+ If you have any questions about leaflet, please refer them to the Leaflet maintainers at
48
+ http://leafletjs.com. If you have any questions about how leaflet-js wraps
49
+ leaflet, then please refer to https://github.com/cfis/leaflet-js.
50
+
51
+ == License
52
+
53
+ See LICENSE for license information about leaflet-js. Please note that the Leaflet project
54
+ has its own LICENSE file also.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "rubygems/package_task"
5
+
6
+ GEM_NAME = "leaflet-js"
7
+
8
+ # Read the spec file
9
+ spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
10
+
11
+ # Setup generic gem
12
+ Gem::PackageTask.new(spec) do |pkg|
13
+ pkg.package_dir = 'pkg'
14
+ pkg.need_tar = false
15
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ Gem::Specification.new do |spec|
3
+ spec.name = 'leaflet-js'
4
+ spec.version = '0.6.beta4'
5
+ spec.homepage = 'https://github.com/cfis/leaflet-js'
6
+ spec.summary = <<-EOS
7
+ Wraps the Leaflet Javascript Mapping Library in a Rails asset gem. Also include Leaflet.Label
8
+ and Leaflet.Draw plusins. For more information
9
+ about Leaflet please see http://leafletjs.com/
10
+ EOS
11
+
12
+ spec.authors = ['Charlie Savage']
13
+ spec.platform = Gem::Platform::RUBY
14
+ spec.files = Dir.glob(['leaflet-js.gemspec',
15
+ 'CHANGELOG.rdoc',
16
+ 'LICENSE',
17
+ 'Rakefile',
18
+ 'README.rdoc',
19
+ 'lib/leaflet-js.rb',
20
+ 'lib/leaflet/**/*',
21
+ 'lib/leaflet.draw/**/*',
22
+ 'lib/leaflet.label/**/*',
23
+ 'vendor/assets/images/*',
24
+ 'vendor/assets/stylesheets/*',
25
+ 'vendor/assets/javascripts/*'])
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+ spec.date = Time.now
28
+ end
@@ -0,0 +1,10 @@
1
+ module Leaflet
2
+ class Engine < Rails::Engine
3
+ initializer :append_assets_path do |app|
4
+ # Javascripts
5
+ app.config.assets.paths << File.join(config.root, 'lib', 'leaflet', 'src')
6
+ app.config.assets.paths << File.join(config.root, 'lib', 'leaflet.draw', 'src')
7
+ app.config.assets.paths << File.join(config.root, 'lib', 'leaflet.label', 'src')
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,54 @@
1
+ # How to upgrade from 0.1 to 0.2
2
+
3
+ There are a number of changes to the plugin in 0.2 that may break peoples implementations of Leaflet.draw 0.1. If you I will try my best to list any changes here.
4
+
5
+ ## Event consolidation
6
+
7
+ Leaflet.draw 0.1 had a created event for each different shape that was created. 0.2 now consolitates these into a single created shape.
8
+
9
+ The vector or marker is accessed by the `layer` property of the event arguments, the type of layer by the `layerType`.
10
+
11
+ #### New way
12
+
13
+ ````js
14
+ map.on('draw:created', function (e) {
15
+ var type = e.layerType,
16
+ layer = e.layer;
17
+
18
+ if (type === 'marker') {
19
+ // Do any marker specific logic here
20
+ }
21
+
22
+ map.addLayer(layer);
23
+ });
24
+ ````
25
+
26
+ #### Old way
27
+
28
+ ````js
29
+ map.on('draw:poly-created', function (e) {
30
+ map.addLayer(e.poly);
31
+ });
32
+ map.on('draw:rectangle-created', function (e) {
33
+ map.addLayer(e.rect);
34
+ });
35
+ map.on('draw:circle-created', function (e) {
36
+ map.addLayer(e.circ);
37
+ });
38
+ map.on('draw:marker-created', function (e) {
39
+ e.marker.bindPopup('A popup!');
40
+ map.addLayer(e.marker);
41
+ });
42
+ ````
43
+
44
+ ## Draw handler started/stopped event change
45
+
46
+ Renamed the drawing started and stopped events to be the same as the created standard.
47
+
48
+ `drawing` -> `draw:drawstart` and `drawing-disabled` -> `draw:drawstop`.
49
+
50
+ The event argument has also changed from `drawingType` -> `layerType`.
51
+
52
+ ## CSS changes
53
+
54
+ There has been a whole bunch of CSS changes, if you have customized any of these plese see [leaflet.draw.css](https://github.com/Leaflet/Leaflet.draw/blob/master/dist/leaflet.draw.css).
@@ -0,0 +1,73 @@
1
+ Leaflet.draw Changelog
2
+ ======================
3
+
4
+ ## master
5
+
6
+ An in-progress version being developed on the master branch.
7
+
8
+ ### Improvements
9
+
10
+ * `draw:edited` now returns a `FeatureGroup` of features edited. (by [@jmkelly](https://github.com/jmkelly)). [#95](https://github.com/Leaflet/Leaflet.draw/pull/95)
11
+ * Circle tooltip shows the radius (in m) while drawing.
12
+ * Added Leaflet version check to inform developers that Leaflet 0.6+ is required.
13
+ * Added ability to finish drawing polygons by double clicking. (inspired by [@snkashis](https://github.com/snkashis)). [#121](https://github.com/Leaflet/Leaflet.label/pull/121)
14
+ * Added test environment. (by [@iirvine](https://github.com/iirvine)). [#123](https://github.com/Leaflet/Leaflet.draw/pull/123)
15
+
16
+ ### Bugfixes
17
+
18
+ * Fixed issue where removing a vertex or adding a new one via midpoints would not update the edited state for polylines and polygons.
19
+ * Fixed issue where not passing in the context to `off()` would result in the event from not being unbound.(by [@koppelbakje](https://github.com/koppelbakje)). [#95](https://github.com/Leaflet/Leaflet.draw/pull/112)
20
+ * Fixed issue where removing the draw control from the map would result in an error.
21
+ * Fixed bug where removing points created by dragging midpoints would cause the polyline to not reflect any newly created points.
22
+
23
+ ## 0.2.0 (February 20, 2013)
24
+
25
+ Major new version. Added Edit toolbar which allows editing and deleting shapes.
26
+
27
+ ### Features
28
+
29
+ * Consistant event for shape creation. (by [@krikrou](https://github.com/krikrou)). [#58](https://github.com/Leaflet/Leaflet.draw/pull/58)
30
+
31
+ ### Bugfixes
32
+
33
+ * Fixed adding markers over vector layers. (by [@Starefossen](https://github.com/Starefossen)). [#82](https://github.com/Leaflet/Leaflet.draw/pull/82)
34
+
35
+ ## 0.1.7 (February 11, 2013)
36
+
37
+ * Add sanity check for toolbar buttons when adding top and bottom classes. (by [@yohanboniface](https://github.com/yohanboniface)). [#60](https://github.com/Leaflet/Leaflet.draw/pull/60)
38
+
39
+ ## 0.1.6 (January 17, 2013)
40
+
41
+ * Updated toolbar styles to be in line with the new Leaflet zoom in/out styles.
42
+
43
+ ## 0.1.5 (December 10, 2012)
44
+
45
+ ### Features
46
+
47
+ * Added 'drawing-disabled' event fired on the map when a draw handler is disabled. (by [@ajbeaven](https://github.com/thegreat)). [#35](https://github.com/jacobtoye/Leaflet.draw/pull/35)
48
+ * Added 'drawing' event fired on the map when a draw handler is actived. (by [@ajbeaven](https://github.com/thegreat)). [#30](https://github.com/jacobtoye/Leaflet.draw/pull/30)
49
+
50
+ ### Bugfixes
51
+
52
+ * Stopped L.Control.Draw from storing handlers in it's prototype. (by [@thegreat](https://github.com/thegreat)). [#37](https://github.com/jacobtoye/Leaflet.draw/pull/37)
53
+
54
+ ## 0.1.4 (October 8, 2012)
55
+
56
+ ### Bugfixes
57
+
58
+ * Fixed a bug that would cause an error when creating rectangles/circles withought moving the mouse. (by [@inpursuit](https://github.com/inpursuit)). [#25](https://github.com/jacobtoye/Leaflet.draw/pull/25)
59
+ * Fixed a bug that would cause an error when clicking a different drawing tool while another mode enabled. (by [@thegreat](https://github.com/thegreat)). [#27](https://github.com/jacobtoye/Leaflet.draw/pull/27)
60
+ * Fixed control buttons breaking plugin in oldIE.
61
+ * Fixed drawing polylines and polygons in oldIE.
62
+
63
+ ## 0.1.3 (October 3, 2012)
64
+
65
+ ### Bugfixes
66
+
67
+ * Tip label will now show over vertex markers.
68
+ * Added ability to draw on top of existing markers and vector layers.
69
+ * Clicking on a map object that has a click handler no longer triggers the click event when in drawing mode.
70
+
71
+ ## Pre-0.1.3
72
+
73
+ Check the commit history for changes previous to 0.1.3.
@@ -0,0 +1,26 @@
1
+ /*
2
+ Leaflet.draw building 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 uglify-js
8
+ npm install jshint
9
+
10
+ To check the code and build Leaflet from source, run "jake"
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
+
17
+ desc('Check Leaflet.Draw source for errors with JSHint');
18
+ task('lint', build.lint);
19
+
20
+ desc('Combine and compress Leaflet.Draw source files');
21
+ task('build', ['lint'], build.build);
22
+
23
+ desc('Run PhantomJS tests');
24
+ task('test', ['lint'], build.test);
25
+
26
+ task('default', ['build']);
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Jacob Toye
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,364 @@
1
+ # Important
2
+ You will need to download the latest Leaflet from master in the [Github repo](https://github.com/Leaflet/Leaflet) before Leaflet.draw 0.2.0 will work.
3
+
4
+ #Leaflet.draw
5
+ Adds support for drawing and editing vectors and markers on [Leaflet maps](https://github.com/Leaflet/Leaflet). Check out the [demo](http://leaflet.github.com/Leaflet.draw/)
6
+
7
+ #### Upgrading from Leaflet.draw 0.1
8
+
9
+ Leaflet.draw 0.2.0 changes a LOT of things from 0.1. Please see [BREAKING CHANGES](https://github.com/Leaflet/Leaflet.draw/blob/master/BREAKINGCHANGES.md) for how to upgrade.
10
+
11
+ ## Table of Contents
12
+ [Using the plugin](#using)
13
+ [Advanced Options](#options)
14
+ [Command tasks](#tasks)
15
+ [Thanks](#thanks)
16
+
17
+ <a name="using" />
18
+ ## Using the plugin
19
+
20
+ The default state for the control is the draw toolbar just below the zoom control. This will allow map users to draw vectors and markers. **Please note the edit toolbar is not enabled by default.**
21
+
22
+ Too add the draw toolbar set the option `drawControl: true` in the map options.
23
+
24
+ ````js
25
+ // create a map in the "map" div, set the view to a given place and zoom
26
+ var map = L.map('map', {drawControl: true}).setView([51.505, -0.09], 13);
27
+
28
+ // add an OpenStreetMap tile layer
29
+ L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
30
+ attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
31
+ }).addTo(map);
32
+ ````
33
+
34
+ ### Adding the edit toolbar
35
+
36
+ To use the edit toolbar you must initialise the Leaflet.draw control and manually add it to the map.
37
+
38
+ ````js
39
+ // create a map in the "map" div, set the view to a given place and zoom
40
+ var map = L.map('map').setView([51.505, -0.09], 13);
41
+
42
+ // add an OpenStreetMap tile layer
43
+ L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
44
+ attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
45
+ }).addTo(map);
46
+
47
+ // Initialize the FeatureGroup to store editable layers
48
+ var drawnItems = new L.FeatureGroup();
49
+ map.addLayer(drawnItems);
50
+
51
+ // Initialize the draw control and pass it the FeatureGroup of editable layers
52
+ var drawControl = new L.Control.Draw({
53
+ edit: {
54
+ featureGroup: drawnItems
55
+ }
56
+ });
57
+ map.addControl(drawControl);
58
+ ````
59
+
60
+ The key here is the `featureGroup` option. This tells the plugin which `FeatureGroup` that contains the layers that should be editable.
61
+
62
+ ### Events
63
+
64
+ Once you have successfully added the Leaflet.draw plugin your map you will want to respond to the different actions users can do. The following events will be triggered on the map:
65
+
66
+ #### draw:created
67
+
68
+ | Property | Type | Description
69
+ | --- | --- | ---
70
+ | layer | [Polyline](http://leafletjs.com/reference.html#polyline)/[Polygon](http://leafletjs.com/reference.html#polygon)/[Rectangle](http://leafletjs.com/reference.html#rectangle)/[Circle](http://leafletjs.com/reference.html#circle)/[Marker](http://leafletjs.com/reference.html#marker) | Layer that was just created.
71
+ | layerType | String | The type of layer this is. One of: `polyline`, `polygon`, `rectangle`, `circle`, `marker`
72
+
73
+
74
+ Triggered when a new vector or marker has been created.
75
+
76
+ ````js
77
+ map.on('draw:created', function (e) {
78
+ var type = e.layerType,
79
+ layer = e.layer;
80
+
81
+ if (type === 'marker') {
82
+ // Do marker specific actions
83
+ }
84
+
85
+ // Do whatever else you need to. (save to db, add to map etc)
86
+ map.addLayer(layer);
87
+ });
88
+ ````
89
+
90
+ #### draw:edited
91
+
92
+ | Property | Type | Description
93
+ | --- | --- | ---
94
+ | layers | [LayerGroup](http://leafletjs.com/reference.html#layergroup) | List of all layers just edited on the map.
95
+
96
+ Triggered when layers in the FeatureGroup, that the plugin was initialized with, have been edited and saved.
97
+
98
+ ````js
99
+ map.on('draw:edited', function (e) {
100
+ var layers = e.layers;
101
+ layers.eachLayer(function (layer) {
102
+ //do whatever you want, most likely save back to db
103
+ });
104
+ });
105
+ ````
106
+
107
+ #### draw:deleted
108
+
109
+ Triggered when layers have been layers have been removed (and saved) from the FeatureGroup.
110
+
111
+ | Property | Type | Description
112
+ | --- | --- | ---
113
+ | layers | [LayerGroup](http://leafletjs.com/reference.html#layergroup) | List of all layers just removed from the map.
114
+
115
+ #### draw:drawstart
116
+
117
+ Triggered when the user has chosen to draw a particular vector or marker.
118
+
119
+ | Property | Type | Description
120
+ | --- | --- | ---
121
+ | layerType | String | The type of layer this is. One of: `polyline`, `polygon`, `rectangle`, `circle`, `marker`
122
+
123
+ #### draw:drawstop
124
+
125
+ Triggered when the user has finshed a particular vector or marker.
126
+
127
+ | Property | Type | Description
128
+ | --- | --- | ---
129
+ | layerType | String | The type of layer this is. One of: `polyline`, `polygon`, `rectangle`, `circle`, `marker`
130
+
131
+ <a name="options" />
132
+ ## Advanced options
133
+
134
+ You can configure the plugin by using the different options listed here.
135
+
136
+ ### Control.Draw
137
+
138
+ These options make up the root object that is used when initializing the Leaflet.draw control.
139
+
140
+ | Option | Type | Default | Description
141
+ | --- | --- | --- | ---
142
+ | position | String | `'topleft'` | The initial position of the control (one of the map corners). See [control positions](http://leafletjs.com/reference.html#control-positions).
143
+ | draw | [DrawOptions](#drawoptions) | `{}` | The options used to configure the draw toolbar.
144
+ | edit | [EditOptions](#editoptions) | `false` | The options used to configure the edit toolbar.
145
+
146
+ <a name="drawoptions" />
147
+ ### DrawOptions
148
+
149
+ These options will allow you to configure the draw toolbar and it's handlers.
150
+
151
+ | Option | Type | Default | Description
152
+ | --- | --- | --- | ---
153
+ | polyline | [PolylineOptions](#polylineoptions) | `{ title: 'Draw a polyline' }` | Polyline draw handler options.
154
+ | polygon | [PolygonOptions](#polygonoptions) | `{ title: 'Draw a polygon' }` | Polygon draw handler options.
155
+ | rectangle | [RectangleOptions](#rectangleoptions) | `{ title: 'Draw a rectangle' }` | Rectangle draw handler options.
156
+ | circle | [CircleOptions](#circleoptions) | `{ title: 'Draw a circle' }` | Circle draw handler options.
157
+ | marker | [MarkerOptions](#markeroptions) | `{ title: 'Add a marker' }` | Marker draw handler options.
158
+
159
+ ### Draw handler options
160
+
161
+ The following options will allow you to configure the individual draw handlers.
162
+
163
+ <a name="polylineoptions" />
164
+ <a name="polygonoptions" />
165
+ #### PolylineOptions and PolygonOptions
166
+
167
+ Polyline and Polygon drawing handlers take the same options.
168
+
169
+ | Option | Type | Default | Description
170
+ | --- | --- | --- | ---
171
+ | title | String | `'Draw a Polyline (Polygon)'` | The title used for the polyline/polygon button.
172
+ | allowIntersection | Bool | `true` | Determines if line segements can cross.
173
+ | drawError | Object | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Polyline.js#L10) | Configuration options for the error that displays if an intersection is detected.
174
+ | guidelineDistance | Number | `20` | Distance in pixels between each guide dash.
175
+ | shapeOptions | [Leaflet Polyline options](http://leafletjs.com/reference.html#polyline-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Polyline.js#L20) | The options used when drawing the polyline/polygon on the map.
176
+ | zIndexOffset | Number | `2000` | This should be a high number to ensure that you can draw over all other layers on the map.
177
+
178
+ <a name="rectangleoptions" />
179
+ #### RectangleOptions
180
+
181
+ | Option | Type | Default | Description
182
+ | --- | --- | --- | ---
183
+ | title | String | `'Draw a rectangle.'` | The title used for the rectangle button.
184
+ | shapeOptions | [Leaflet Path options](http://leafletjs.com/reference.html#path-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Rectangle.js#L7) | The options used when drawing the rectangle on the map.
185
+
186
+ <a name="circleoptions" />
187
+ #### CircleOptions
188
+
189
+ | Option | Type | Default | Description
190
+ | --- | --- | --- | ---
191
+ | title | String | `'Draw a circle.'` | The title used for the circle button.
192
+ | shapeOptions | [Leaflet Path options](http://leafletjs.com/reference.html#path-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/draw/handler/Draw.Circle.js#L7) | The options used when drawing the circle on the map.
193
+
194
+ <a name="markeroptions" />
195
+ #### MarkerOptions
196
+
197
+ | Option | Type | Default | Description
198
+ | --- | --- | --- | ---
199
+ | title | String | `'Add a marker.'` | The title used for the marker button.
200
+ | icon | [Leaflet Icon](http://leafletjs.com/reference.html#icon) | `L.Icon.Default()` | The icon displayed when drawing a marker.
201
+ | zIndexOffset | Number | `2000` | This should be a high number to ensure that you can draw over all other layers on the map.
202
+
203
+ <a name="editoptions" />
204
+ ### EditOptions
205
+
206
+ These options will allow you to configure the draw toolbar and its handlers.
207
+
208
+ | Option | Type | Default | Description
209
+ | --- | --- | --- | ---
210
+ | featureGroup | [Leaflet FeatureGroup](http://leafletjs.com/reference.html#featuregroup) | `null` | This is the FeatureGroup that stores all editable shapes. **THIS iS REQUIRED FOR THE EDIT TOOLBAR TO WORK**
211
+ | edit | [EditHandlerOptions](#edithandleroptions) | `{ title: 'Edit layers' }` | Edit handler options.
212
+ | remove | [DeleteHandlerOptions](#deletehandleroptions) | `{ title: 'Delete layers' }` | Delete handler options.
213
+
214
+ <a name="edithandleroptions" />
215
+ #### EditHandlerOptions
216
+
217
+ | Option | Type | Default | Description
218
+ | --- | --- | --- | ---
219
+ | title | String | `'Edit Layers'` | The title used for the edit button.
220
+ | selectedPathOptions | [Leaflet Path options](http://leafletjs.com/reference.html#path-options) | [See code](https://github.com/Leaflet/Leaflet.draw/blob/master/src/edit/handler/EditToolbar.Edit.js#L9) | The path options for how the layers will look like while in edit mode.
221
+
222
+ <a name="deletehandleroptions" />
223
+ #### DeleteHandlerOptions
224
+
225
+ | Option | Type | Default | Description
226
+ | --- | --- | --- | ---
227
+ | title | String | `'Remove Layers'` | The title used for the delete button.
228
+
229
+ <a name="commontasks" />
230
+ ## Common tasks
231
+
232
+ The following examples outline some common tasks.
233
+
234
+ ### Example Leaflet.draw config
235
+
236
+ The following example will show you how to:
237
+
238
+ 1. Change the position of the control's toolbar.
239
+ 2. Customize the styles of a vector layer.
240
+ 3. Use a custom marker.
241
+ 4. Disable the delete functionality.
242
+
243
+ ````js
244
+ var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
245
+ cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
246
+ map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
247
+
248
+ var editableLayers = new L.FeatureGroup();
249
+ map.addLayer(editableLayers);
250
+
251
+ var MyCustomMarker = L.Icon.extend({
252
+ options: {
253
+ shadowUrl: null,
254
+ iconAnchor: new L.Point(12, 12),
255
+ iconSize: new L.Point(24, 24),
256
+ iconUrl: 'link/to/image.png'
257
+ }
258
+ });
259
+
260
+ var options = {
261
+ position: 'topright',
262
+ draw: {
263
+ polyline: {
264
+ title: 'Draw a kick ass polyline!'
265
+ shapeOptions: {
266
+ color: '#f357a1',
267
+ weight: 10
268
+ }
269
+ },
270
+ polygon: {
271
+ allowIntersection: false, // Restricts shapes to simple polygons
272
+ drawError: {
273
+ color: '#e1e100, // Color the shape will turn when intersects
274
+ message: '<strong>Oh snap!<strong> you can\'t draw that!' // Message that will show when intersect
275
+ },
276
+ shapeOptions: {
277
+ color: '#bada55'
278
+ }
279
+ },
280
+ circle: false, // Turns off this drawing tool
281
+ rectangle: {
282
+ shapeOptions: {
283
+ clickable: false
284
+ }
285
+ },
286
+ marker: {
287
+ icon: new MyCustomMarker()
288
+ }
289
+ },
290
+ edit: {
291
+ featureGroup: editableLayers, //REQUIRED!!
292
+ remove: false
293
+ }
294
+ };
295
+
296
+ var drawControl = new L.Control.Draw(options);
297
+ map.addControl(drawControl);
298
+
299
+ map.on('draw:created', function (e) {
300
+ var type = e.layerType,
301
+ layer = e.layer;
302
+
303
+ if (type === 'marker') {
304
+ layer.bindPopup('A popup!');
305
+ }
306
+
307
+ drawnItems.addLayer(layer);
308
+ });
309
+ ````
310
+
311
+ ### Disabling a toolbar
312
+
313
+ If you do not want a particular toolbar in your app you can turn it off by setting the toolbar to false.
314
+
315
+ ````js
316
+ var drawControl = new L.Control.Draw({
317
+ draw: false,
318
+ edit: {
319
+ featureGroup: editableLayers
320
+ }
321
+ });
322
+ ````
323
+
324
+ ### Disabling a toolbar item
325
+
326
+ If you want to turn off a particular toolbar item, set it to false. The following disables drawing polygons and markers. It also turns off the ability to edit layers.
327
+
328
+ ````js
329
+ var drawControl = new L.Control.Draw({
330
+ draw: {
331
+ polygon: false,
332
+ marker: false
333
+ },
334
+ edit: {
335
+ featureGroup: editableLayers,
336
+ edit: false
337
+ }
338
+ });
339
+ ````
340
+
341
+ ### Changing a drawing handlers options
342
+
343
+ You can change a draw handlers options after initialization by using the `setDrawingOptions` method on the Leaflet.draw control.
344
+
345
+ E.g. to change the colour of the rectangle:
346
+
347
+ ````js
348
+ drawControl.setDrawingOptions(
349
+ rectangle: {
350
+ color: '#0000FF'
351
+ }
352
+ );
353
+ ````
354
+
355
+ <a name="thanks" />
356
+ ## Thanks
357
+
358
+ Thanks so much to [@brunob](https://github.com/brunob), [@tnightingale](https://github.com/tnightingale), and [@shramov](https://github.com/shramov). I got a lot of ideas from their Leaflet plugins.
359
+
360
+ All the [contributors](https://github.com/Leaflet/Leaflet.draw/graphs/contributors) and issue reporters of this plugin rock. Thanks for tidying up my mess and keeping the plugin on track.
361
+
362
+ The icons used for some of the toolbar buttons are either from http://glyphicons.com/ or inspired by them. <3 Glyphicons!
363
+
364
+ Finally, [@mourner](https://github.com/mourner) is the man! Thanks for dedicating so much of your time to create the gosh darn best JavaScript mapping library around.