leaflet-js 0.7.0.4 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +10 -3
  3. data/Rakefile +3 -3
  4. data/leaflet-js.gemspec +13 -7
  5. data/lib/leaflet-js.rb +2 -10
  6. data/lib/leaflet-js/engine.rb +7 -0
  7. data/lib/leaflet-js/version.rb +3 -0
  8. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
  9. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/dist/images/spritesheet.png +0 -0
  10. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Control.Draw.js +21 -19
  11. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Leaflet.draw.js +8 -3
  12. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Toolbar.js +75 -14
  13. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Tooltip.js +0 -0
  14. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/copyright.js +0 -0
  15. data/vendor/assets/Leaflet.draw/src/draw/DrawToolbar.js +87 -0
  16. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Circle.js +2 -3
  17. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Feature.js +4 -4
  18. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
  19. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Polygon.js +9 -7
  20. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Polyline.js +86 -36
  21. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Rectangle.js +19 -1
  22. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +18 -4
  23. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/EditToolbar.js +34 -43
  24. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
  25. data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +75 -0
  26. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Poly.js +16 -2
  27. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Rectangle.js +3 -3
  28. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +13 -3
  29. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +11 -7
  30. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +26 -94
  31. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/GeometryUtil.js +3 -3
  32. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/LatLngUtil.js +0 -0
  33. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
  34. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
  35. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/Polyline.Intersect.js +3 -3
  36. data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/images/spritesheet.svg +0 -0
  37. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/BaseMarkerMethods.js +0 -0
  38. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/CircleMarker.Label.js +0 -0
  39. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/FeatureGroup.Label.js +0 -0
  40. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Label.js +5 -2
  41. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Leaflet.label.js +1 -1
  42. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Map.Label.js +0 -0
  43. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Marker.Label.js +0 -0
  44. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Path.Label.js +0 -0
  45. data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/copyright.js +0 -0
  46. data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/layers-2x.png +0 -0
  47. data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/layers.png +0 -0
  48. data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-icon-2x.png +0 -0
  49. data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-icon.png +0 -0
  50. data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-shadow.png +0 -0
  51. data/{lib/leaflet → vendor/assets/Leaflet}/src/Leaflet.js +1 -1
  52. data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Attribution.js +0 -0
  53. data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Layers.js +2 -2
  54. data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Scale.js +0 -0
  55. data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Zoom.js +0 -0
  56. data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.js +0 -0
  57. data/{lib/leaflet → vendor/assets/Leaflet}/src/copyright.js +0 -0
  58. data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Browser.js +5 -36
  59. data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Class.js +0 -0
  60. data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Events.js +0 -0
  61. data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Handler.js +0 -0
  62. data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Util.js +9 -14
  63. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.DoubleTap.js +0 -0
  64. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.Pointer.js +3 -2
  65. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.js +7 -18
  66. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomUtil.js +0 -5
  67. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/Draggable.js +10 -4
  68. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/PosAnimation.Timer.js +0 -0
  69. data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/PosAnimation.js +0 -0
  70. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/LatLng.js +0 -0
  71. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/LatLngBounds.js +0 -0
  72. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG3395.js +0 -0
  73. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG3857.js +0 -0
  74. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG4326.js +0 -0
  75. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.Simple.js +0 -0
  76. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.js +0 -0
  77. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.LonLat.js +0 -0
  78. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.Mercator.js +0 -0
  79. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.SphericalMercator.js +0 -0
  80. data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.js +0 -0
  81. data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Bounds.js +0 -0
  82. data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/LineUtil.js +1 -1
  83. data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Point.js +0 -0
  84. data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/PolyUtil.js +0 -0
  85. data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Transformation.js +0 -0
  86. data/{lib/leaflet → vendor/assets/Leaflet}/src/images/layers.svg +0 -0
  87. data/{lib/leaflet → vendor/assets/Leaflet}/src/images/marker.svg +0 -0
  88. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/FeatureGroup.js +5 -3
  89. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/GeoJSON.js +0 -0
  90. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/ImageOverlay.js +0 -0
  91. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/LayerGroup.js +0 -0
  92. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/Popup.js +0 -0
  93. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/DivIcon.js +0 -0
  94. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Icon.Default.js +0 -0
  95. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Icon.js +0 -0
  96. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.Drag.js +0 -0
  97. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.Popup.js +1 -0
  98. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.js +2 -4
  99. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.Anim.js +5 -0
  100. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.Canvas.js +0 -0
  101. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.WMS.js +0 -0
  102. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.js +3 -5
  103. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Circle.js +0 -0
  104. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/CircleMarker.js +1 -0
  105. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/MultiPoly.js +0 -0
  106. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.Popup.js +0 -0
  107. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.SVG.js +1 -1
  108. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.VML.js +0 -0
  109. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.js +0 -0
  110. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Polygon.js +0 -0
  111. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Polyline.js +0 -0
  112. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Rectangle.js +0 -0
  113. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Circle.Canvas.js +0 -0
  114. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -0
  115. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Path.Canvas.js +13 -6
  116. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Polygon.Canvas.js +0 -0
  117. data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Polyline.Canvas.js +0 -0
  118. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/Map.js +9 -8
  119. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
  120. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/anim/Map.ZoomAnimation.js +25 -16
  121. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/ext/Map.Geolocation.js +0 -0
  122. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.BoxZoom.js +0 -0
  123. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
  124. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Drag.js +0 -0
  125. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Keyboard.js +0 -0
  126. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.ScrollWheelZoom.js +0 -0
  127. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Tap.js +0 -0
  128. data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.TouchZoom.js +1 -1
  129. data/vendor/assets/{stylesheets/leaflet-js.css → leaflet-js.css} +0 -0
  130. data/vendor/assets/{javascripts/leaflet-js.js → leaflet-js.js} +2 -2
  131. data/{lib/leaflet.label/libs/leaflet/leaflet.css → vendor/assets/leaflet.css.erb} +2 -2
  132. data/vendor/assets/{stylesheets/leaflet.draw.css.erb → leaflet.draw.css.erb} +2 -2
  133. data/{lib/leaflet.draw/dist → vendor/assets}/leaflet.draw.ie.css +0 -0
  134. data/vendor/assets/leaflet.draw.js +38 -0
  135. data/vendor/assets/leaflet.js +155 -0
  136. data/{lib/leaflet.label/dist → vendor/assets}/leaflet.label.css +0 -0
  137. data/vendor/assets/leaflet.label.js +11 -0
  138. metadata +139 -302
  139. data/lib/leaflet.draw/BREAKINGCHANGES.md +0 -54
  140. data/lib/leaflet.draw/CHANGELOG.md +0 -118
  141. data/lib/leaflet.draw/Jakefile.js +0 -26
  142. data/lib/leaflet.draw/MIT-LICENCE.txt +0 -20
  143. data/lib/leaflet.draw/README.md +0 -411
  144. data/lib/leaflet.draw/TODO.md +0 -62
  145. data/lib/leaflet.draw/build/build.html +0 -243
  146. data/lib/leaflet.draw/build/build.js +0 -189
  147. data/lib/leaflet.draw/build/deps.js +0 -76
  148. data/lib/leaflet.draw/build/hintrc.js +0 -47
  149. data/lib/leaflet.draw/build/leaflet.draw-include.js +0 -42
  150. data/lib/leaflet.draw/dist/leaflet.draw-src.js +0 -2782
  151. data/lib/leaflet.draw/dist/leaflet.draw.css +0 -244
  152. data/lib/leaflet.draw/dist/leaflet.draw.js +0 -10
  153. data/lib/leaflet.draw/examples/basic.html +0 -113
  154. data/lib/leaflet.draw/examples/edithandlers.html +0 -67
  155. data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
  156. data/lib/leaflet.draw/examples/libs/leaflet-src.js +0 -9108
  157. data/lib/leaflet.draw/examples/libs/leaflet.css +0 -478
  158. data/lib/leaflet.draw/package.json +0 -37
  159. data/lib/leaflet.draw/spec/after.js +0 -2
  160. data/lib/leaflet.draw/spec/before.js +0 -3
  161. data/lib/leaflet.draw/spec/expect.js +0 -1253
  162. data/lib/leaflet.draw/spec/happen.js +0 -93
  163. data/lib/leaflet.draw/spec/index.html +0 -36
  164. data/lib/leaflet.draw/spec/karma.conf.js +0 -69
  165. data/lib/leaflet.draw/spec/sinon.js +0 -4223
  166. data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +0 -15
  167. data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +0 -25
  168. data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +0 -9
  169. data/lib/leaflet.draw/spec/suites/SpecHelper.js +0 -26
  170. data/lib/leaflet.draw/src/draw/DrawToolbar.js +0 -111
  171. data/lib/leaflet.label/CHANGELOG.md +0 -67
  172. data/lib/leaflet.label/Jakefile.js +0 -21
  173. data/lib/leaflet.label/MIT-LICENCE.txt +0 -20
  174. data/lib/leaflet.label/README.md +0 -103
  175. data/lib/leaflet.label/build/build.js +0 -155
  176. data/lib/leaflet.label/build/deps.js +0 -26
  177. data/lib/leaflet.label/build/hint.js +0 -30
  178. data/lib/leaflet.label/build/hintrc.js +0 -51
  179. data/lib/leaflet.label/dist/images/death.png +0 -0
  180. data/lib/leaflet.label/dist/leaflet.label-src.js +0 -542
  181. data/lib/leaflet.label/dist/leaflet.label.js +0 -9
  182. data/lib/leaflet.label/example/label.html +0 -85
  183. data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
  184. data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
  185. data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
  186. data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
  187. data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
  188. data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
  189. data/lib/leaflet.label/libs/leaflet/leaflet-src.js +0 -9108
  190. data/lib/leaflet.label/libs/leaflet/leaflet.js +0 -9
  191. data/lib/leaflet.label/package.json +0 -19
  192. data/lib/leaflet/CHANGELOG.md +0 -905
  193. data/lib/leaflet/CONTRIBUTING.md +0 -155
  194. data/lib/leaflet/FAQ.md +0 -138
  195. data/lib/leaflet/Jakefile.js +0 -46
  196. data/lib/leaflet/LICENSE +0 -23
  197. data/lib/leaflet/PLUGIN-GUIDE.md +0 -127
  198. data/lib/leaflet/README.md +0 -34
  199. data/lib/leaflet/build/build.html +0 -227
  200. data/lib/leaflet/build/build.js +0 -163
  201. data/lib/leaflet/build/deps.js +0 -259
  202. data/lib/leaflet/build/hintrc.js +0 -39
  203. data/lib/leaflet/debug/css/mobile.css +0 -6
  204. data/lib/leaflet/debug/css/screen.css +0 -5
  205. data/lib/leaflet/debug/hacks/jitter.html +0 -42
  206. data/lib/leaflet/debug/leaflet-include.js +0 -59
  207. data/lib/leaflet/debug/map/canvas.html +0 -46
  208. data/lib/leaflet/debug/map/controls.html +0 -49
  209. data/lib/leaflet/debug/map/geolocation.html +0 -34
  210. data/lib/leaflet/debug/map/iframe.html +0 -11
  211. data/lib/leaflet/debug/map/image-overlay.html +0 -43
  212. data/lib/leaflet/debug/map/map-mobile.html +0 -34
  213. data/lib/leaflet/debug/map/map.html +0 -59
  214. data/lib/leaflet/debug/map/max-bounds.html +0 -38
  215. data/lib/leaflet/debug/map/opacity.html +0 -223
  216. data/lib/leaflet/debug/map/scroll.html +0 -41
  217. data/lib/leaflet/debug/map/simple-proj.html +0 -44
  218. data/lib/leaflet/debug/map/wms-marble.html +0 -30
  219. data/lib/leaflet/debug/map/wms.html +0 -40
  220. data/lib/leaflet/debug/map/zoomlevels.html +0 -45
  221. data/lib/leaflet/debug/tests/add_remove_layers.html +0 -87
  222. data/lib/leaflet/debug/tests/bringtoback.html +0 -37
  223. data/lib/leaflet/debug/tests/canvasloop.html +0 -47
  224. data/lib/leaflet/debug/tests/click_on_canvas.html +0 -58
  225. data/lib/leaflet/debug/tests/click_on_canvas_broken.html +0 -49
  226. data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +0 -61
  227. data/lib/leaflet/debug/tests/opacity.html +0 -56
  228. data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +0 -59
  229. data/lib/leaflet/debug/tests/remove_while_dragging.html +0 -28
  230. data/lib/leaflet/debug/tests/removetilewhilepan.html +0 -41
  231. data/lib/leaflet/debug/tests/reuse_popups.html +0 -40
  232. data/lib/leaflet/debug/tests/rtl.html +0 -42
  233. data/lib/leaflet/debug/tests/rtl2.html +0 -27
  234. data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +0 -43
  235. data/lib/leaflet/debug/tests/svg_clicks.html +0 -54
  236. data/lib/leaflet/debug/vector/bounds-extend.html +0 -88
  237. data/lib/leaflet/debug/vector/feature-group-bounds.html +0 -90
  238. data/lib/leaflet/debug/vector/geojson-sample.js +0 -53
  239. data/lib/leaflet/debug/vector/geojson.html +0 -173
  240. data/lib/leaflet/debug/vector/rectangle.html +0 -53
  241. data/lib/leaflet/debug/vector/route.js +0 -1
  242. data/lib/leaflet/debug/vector/touchzoomemu.html +0 -194
  243. data/lib/leaflet/debug/vector/us-states.js +0 -54
  244. data/lib/leaflet/debug/vector/vector-bounds.html +0 -69
  245. data/lib/leaflet/debug/vector/vector-canvas.html +0 -92
  246. data/lib/leaflet/debug/vector/vector-mobile.html +0 -38
  247. data/lib/leaflet/debug/vector/vector-simple.html +0 -48
  248. data/lib/leaflet/debug/vector/vector.html +0 -37
  249. data/lib/leaflet/dist/images/layers-2x.png +0 -0
  250. data/lib/leaflet/dist/images/layers.png +0 -0
  251. data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
  252. data/lib/leaflet/dist/images/marker-icon.png +0 -0
  253. data/lib/leaflet/dist/images/marker-shadow.png +0 -0
  254. data/lib/leaflet/dist/leaflet.css +0 -478
  255. data/lib/leaflet/package.json +0 -27
  256. data/lib/leaflet/spec/after.js +0 -2
  257. data/lib/leaflet/spec/before.js +0 -3
  258. data/lib/leaflet/spec/expect.js +0 -1253
  259. data/lib/leaflet/spec/index.html +0 -86
  260. data/lib/leaflet/spec/karma.conf.js +0 -65
  261. data/lib/leaflet/spec/sinon.js +0 -4223
  262. data/lib/leaflet/spec/spec.hintrc.js +0 -25
  263. data/lib/leaflet/spec/suites/LeafletSpec.js +0 -13
  264. data/lib/leaflet/spec/suites/SpecHelper.js +0 -42
  265. data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +0 -68
  266. data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +0 -67
  267. data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +0 -6
  268. data/lib/leaflet/spec/suites/core/ClassSpec.js +0 -156
  269. data/lib/leaflet/spec/suites/core/EventsSpec.js +0 -392
  270. data/lib/leaflet/spec/suites/core/UtilSpec.js +0 -256
  271. data/lib/leaflet/spec/suites/dom/DomEventSpec.js +0 -102
  272. data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +0 -82
  273. data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +0 -27
  274. data/lib/leaflet/spec/suites/geo/CRSSpec.js +0 -47
  275. data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +0 -144
  276. data/lib/leaflet/spec/suites/geo/LatLngSpec.js +0 -132
  277. data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +0 -48
  278. data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +0 -87
  279. data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +0 -75
  280. data/lib/leaflet/spec/suites/geometry/PointSpec.js +0 -104
  281. data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +0 -27
  282. data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +0 -31
  283. data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +0 -86
  284. data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +0 -282
  285. data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +0 -58
  286. data/lib/leaflet/spec/suites/layer/PopupSpec.js +0 -119
  287. data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +0 -88
  288. data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +0 -94
  289. data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +0 -53
  290. data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +0 -17
  291. data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +0 -91
  292. data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +0 -35
  293. data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +0 -55
  294. data/lib/leaflet/spec/suites/map/MapSpec.js +0 -536
  295. data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +0 -38
  296. data/vendor/assets/images/layers-2x.png +0 -0
  297. data/vendor/assets/images/layers.png +0 -0
  298. data/vendor/assets/images/marker-icon-2x.png +0 -0
  299. data/vendor/assets/images/marker-icon.png +0 -0
  300. data/vendor/assets/images/marker-shadow.png +0 -0
  301. data/vendor/assets/images/spritesheet-2x.png +0 -0
  302. data/vendor/assets/images/spritesheet.png +0 -0
  303. data/vendor/assets/javascripts/leaflet.draw.js +0 -37
  304. data/vendor/assets/javascripts/leaflet.js +0 -147
  305. data/vendor/assets/javascripts/leaflet.label.js +0 -11
  306. data/vendor/assets/stylesheets/leaflet.css.erb +0 -478
  307. data/vendor/assets/stylesheets/leaflet.draw.ie.css +0 -49
  308. data/vendor/assets/stylesheets/leaflet.label.css +0 -52
@@ -1,54 +0,0 @@
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).
@@ -1,118 +0,0 @@
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
- * Restrict editing polygons so that at least 3 points are present. (by [@Zverik](https://github.com/Zverik). [#200](https://github.com/Leaflet/Leaflet.draw/pull/200)
11
- * Tooltips initially start hidden until the mouse has been moved. (by [@Zverik](https://github.com/Zverik). [#210](https://github.com/Leaflet/Leaflet.draw/pull/210)
12
-
13
- ### Bugfixes
14
-
15
- * Fix edit toolbar so diabled state is represented correctly. (by [@joeybaker](https://github.com/joeybaker)). [#203](https://github.com/Leaflet/Leaflet.draw/pull/203)
16
- * Fixed path middle marker positions. (by [@Zverik](https://github.com/Zverik)). [#208](https://github.com/Leaflet/Leaflet.draw/pull/208)
17
- * Fix issue where toolbar buttons would have focus after clicked so couldn't use escape to cancel until clicked map at least once.
18
- * Fix toolbar icons for retina displays. (by [@dwnoble](https://github.com/dwnoble)). [#217](https://github.com/Leaflet/Leaflet.draw/pull/217)
19
- * Ensure that options are not shared between draw handler classes. (by [@yohanboniface](https://github.com/yohanboniface). [#219](https://github.com/Leaflet/Leaflet.draw/pull/219)
20
-
21
- ## 0.2.2 (October 4, 2013)
22
-
23
- ### Improvements
24
-
25
- * Refactored the `L.drawLocal' object to be better structured and use this object whereever text is used. *NOTE: THIS IS A NEW FORMAT, SO WILL BRESK ANY EXISTING CUSTOM `L.drawLocal` SETTINGS*.
26
- * Added Imperial measurements to compliment the existing Metric measurements when drawing a polyline or polygon.
27
- * Added `draw:editstart` and `draw:editstop` events. (by [@bhell](https://github.com/bhell)). [#175](https://github.com/Leaflet/Leaflet.draw/pull/175)
28
- * Added `repeatMode` option that will allow repeated drawing of features. (by [@jayhogan](https://github.com/jayhogan) and [@cscheid](https://github.com/cscheid)). [#178](https://github.com/Leaflet/Leaflet.draw/pull/178)
29
- * Added abilit to set circle radius measurement to imperial units.
30
- * Added disabled state for edit/delete buttons when no layers present. (inspired by [@snkashis](https://github.com/snkashis)). [#136](https://github.com/Leaflet/Leaflet.draw/pull/136)
31
- * Add `showLength` and `showRadius` options to circle and polyline. (by [@Zverik](https://github.com/Zverik)). [#195](https://github.com/Leaflet/Leaflet.draw/pull/195)
32
- * Add option to disable tooltips. (by [@Zverik](https://github.com/Zverik)). [#196](https://github.com/Leaflet/Leaflet.draw/pull/196)
33
-
34
- ### Bugfixes
35
-
36
- * Fixed bug where edit handlers could not be disabled.
37
- * Added support for displaying the toolbar on the right hand side of the map. (by [@paulcpederson](https://github.com/paulcpederson)). [#164](https://github.com/Leaflet/Leaflet.draw/pull/164)
38
- * Add flexible width action buttons. (by [@Grsmto](https://github.com/Grsmto)). [#181](https://github.com/Leaflet/Leaflet.draw/pull/181)
39
- * Check for icon existence before disabling edit state. (by [@tmcw](https://github.com/tmcw)). [#182](https://github.com/Leaflet/Leaflet.draw/pull/182)
40
- * Only update guideslines when guidelines are present. (by [@jayhogan](https://github.com/jayhogan)). [#188](https://github.com/Leaflet/Leaflet.draw/pull/188)
41
- * Fixes to localization code so it can be correctly set after files have been loaded.
42
- * Fix for firing `draw:edit` twice for Draw.SimpleShape. (by [@cazacugmihai](https://github.com/cazacugmihai)). [#192](https://github.com/Leaflet/Leaflet.draw/pull/192)
43
- * Fix last edit menu buttons from wrapping. (by [@moiarcsan](https://github.com/moiarcsan)). [#198](https://github.com/Leaflet/Leaflet.draw/pull/198)
44
-
45
- ## 0.2.1 (July 5, 2013)
46
-
47
- ### Improvements
48
-
49
- * `draw:edited` now returns a `FeatureGroup` of features edited. (by [@jmkelly](https://github.com/jmkelly)). [#95](https://github.com/Leaflet/Leaflet.draw/pull/95)
50
- * Circle tooltip shows the radius (in m) while drawing.
51
- * Added Leaflet version check to inform developers that Leaflet 0.6+ is required.
52
- * 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)
53
- * Added test environment. (by [@iirvine](https://github.com/iirvine)). [#123](https://github.com/Leaflet/Leaflet.draw/pull/123)
54
- * Added `L.drawLocal` object to allow users to customize the text used in the plugin. Addresses localization issues. (by [@Starefossen](https://github.com/Starefossen)). [#87](https://github.com/Leaflet/Leaflet.draw/pull/87)
55
- * Added ability to disable edit mode path and marker styles. (inspired by [@markgibbons25](https://github.com/markgibbons25)). [#121](https://github.com/Leaflet/Leaflet.label/pull/137)
56
- * Added area calculation when drawing a polygon.
57
- * Polyline and Polygon tooltips update on click as well as mouse move.
58
-
59
- ### Bugfixes
60
-
61
- * Fixed issue where removing a vertex or adding a new one via midpoints would not update the edited state for polylines and polygons.
62
- * 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)
63
- * Fixed issue where removing the draw control from the map would result in an error.
64
- * Fixed bug where removing points created by dragging midpoints would cause the polyline to not reflect any newly created points.
65
- * Fixed regression where handlers were not able to be disabled.(by [@yohanboniface](https://github.com/yohanboniface)). [#139](https://github.com/Leaflet/Leaflet.draw/pull/139)
66
- * Fixed bug where L.Draw.Polyline would try to remove a non-existant handler if the user cancelled and the polyline only had a single point.
67
-
68
- ## 0.2.0 (February 20, 2013)
69
-
70
- Major new version. Added Edit toolbar which allows editing and deleting shapes.
71
-
72
- ### Features
73
-
74
- * Consistant event for shape creation. (by [@krikrou](https://github.com/krikrou)). [#58](https://github.com/Leaflet/Leaflet.draw/pull/58)
75
-
76
- ### Bugfixes
77
-
78
- * Fixed adding markers over vector layers. (by [@Starefossen](https://github.com/Starefossen)). [#82](https://github.com/Leaflet/Leaflet.draw/pull/82)
79
-
80
- ## 0.1.7 (February 11, 2013)
81
-
82
- * 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)
83
-
84
- ## 0.1.6 (January 17, 2013)
85
-
86
- * Updated toolbar styles to be in line with the new Leaflet zoom in/out styles.
87
-
88
- ## 0.1.5 (December 10, 2012)
89
-
90
- ### Features
91
-
92
- * 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)
93
- * 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)
94
-
95
- ### Bugfixes
96
-
97
- * 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)
98
-
99
- ## 0.1.4 (October 8, 2012)
100
-
101
- ### Bugfixes
102
-
103
- * 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)
104
- * 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)
105
- * Fixed control buttons breaking plugin in oldIE.
106
- * Fixed drawing polylines and polygons in oldIE.
107
-
108
- ## 0.1.3 (October 3, 2012)
109
-
110
- ### Bugfixes
111
-
112
- * Tip label will now show over vertex markers.
113
- * Added ability to draw on top of existing markers and vector layers.
114
- * Clicking on a map object that has a click handler no longer triggers the click event when in drawing mode.
115
-
116
- ## Pre-0.1.3
117
-
118
- Check the commit history for changes previous to 0.1.3.
@@ -1,26 +0,0 @@
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']);
@@ -1,20 +0,0 @@
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.
@@ -1,411 +0,0 @@
1
- # Important
2
- Leaflet.draw 0.2.0 requires [Leaflet 0.6](https://github.com/Leaflet/Leaflet/archive/v0.6.zip) or higher.
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
- [Common tasks](#commontasks)
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
- #### draw:editstart
132
-
133
- Triggered when the user starts edit mode by clicking the edit or remove tool button.
134
-
135
- | Property | Type | Description
136
- | --- | --- | ---
137
- | handler | String | The type of edit this is. One of: `edit`, `remove`
138
-
139
- #### draw:editstop
140
-
141
- Triggered when the user has finshed editing (edit or remove mode) and saves edits.
142
-
143
- | Property | Type | Description
144
- | --- | --- | ---
145
- | handler | String | The type of edit this is. One of: `edit`, `remove`
146
-
147
- <a name="options" />
148
- ## Advanced options
149
-
150
- You can configure the plugin by using the different options listed here.
151
-
152
- ### Control.Draw
153
-
154
- These options make up the root object that is used when initializing the Leaflet.draw control.
155
-
156
- | Option | Type | Default | Description
157
- | --- | --- | --- | ---
158
- | position | String | `'topleft'` | The initial position of the control (one of the map corners). See [control positions](http://leafletjs.com/reference.html#control-positions).
159
- | draw | [DrawOptions](#drawoptions) | `{}` | The options used to configure the draw toolbar.
160
- | edit | [EditOptions](#editoptions) | `false` | The options used to configure the edit toolbar.
161
-
162
- <a name="drawoptions" />
163
- ### DrawOptions
164
-
165
- These options will allow you to configure the draw toolbar and it's handlers.
166
-
167
- | Option | Type | Default | Description
168
- | --- | --- | --- | ---
169
- | polyline | [PolylineOptions](#polylineoptions) | `{ }` | Polyline draw handler options. Set to `false` to disable handler.
170
- | polygon | [PolygonOptions](#polygonoptions) | `{ }` | Polygon draw handler options. Set to `false` to disable handler.
171
- | rectangle | [RectangleOptions](#rectangleoptions) | `{ }` | Rectangle draw handler options. Set to `false` to disable handler.
172
- | circle | [CircleOptions](#circleoptions) | `{ }` | Circle draw handler options. Set to `false` to disable handler.
173
- | marker | [MarkerOptions](#markeroptions) | `{ }` | Marker draw handler options. Set to `false` to disable handler.
174
-
175
- ### Draw handler options
176
-
177
- The following options will allow you to configure the individual draw handlers.
178
-
179
- <a name="polylineoptions" />
180
- #### PolylineOptions
181
-
182
- Polyline and Polygon drawing handlers take the same options.
183
-
184
- | Option | Type | Default | Description
185
- | --- | --- | --- | ---
186
- | allowIntersection | Bool | `true` | Determines if line segements can cross.
187
- | 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.
188
- | guidelineDistance | Number | `20` | Distance in pixels between each guide dash.
189
- | 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.
190
- | metric | Bool | `true` | Determines which measurement system (metric or imperial) is used.
191
- | zIndexOffset | Number | `2000` | This should be a high number to ensure that you can draw over all other layers on the map.
192
- | repeatMode | Bool | `false` | Determines if the draw tool remains enabled after drawing a shape.
193
-
194
- <a name="polygonoptions" />
195
- #### PolygonOptions
196
-
197
- Polygon options include all of the Polyline options plus the option to show the approximate area.
198
-
199
- | Option | Type | Default | Description
200
- | --- | --- | --- | ---
201
- | showArea | Bool | `false` | Show the area of the drawn polygon in m², ha or km². **The area is only approximate and become less accurate the larger the polygon is.**
202
-
203
- <a name="rectangleoptions" />
204
- #### RectangleOptions
205
-
206
- | Option | Type | Default | Description
207
- | --- | --- | --- | ---
208
- | 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.
209
- | repeatMode | Bool | `false` | Determines if the draw tool remains enabled after drawing a shape.
210
-
211
- <a name="circleoptions" />
212
- #### CircleOptions
213
-
214
- | Option | Type | Default | Description
215
- | --- | --- | --- | ---
216
- | 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.
217
- | repeatMode | Bool | `false` | Determines if the draw tool remains enabled after drawing a shape.
218
-
219
- <a name="markeroptions" />
220
- #### MarkerOptions
221
-
222
- | Option | Type | Default | Description
223
- | --- | --- | --- | ---
224
- | icon | [Leaflet Icon](http://leafletjs.com/reference.html#icon) | `L.Icon.Default()` | The icon displayed when drawing a marker.
225
- | zIndexOffset | Number | `2000` | This should be a high number to ensure that you can draw over all other layers on the map.
226
- | repeatMode | Bool | `false` | Determines if the draw tool remains enabled after drawing a shape.
227
-
228
- <a name="editoptions" />
229
- ### EditOptions
230
-
231
- These options will allow you to configure the draw toolbar and its handlers.
232
-
233
- | Option | Type | Default | Description
234
- | --- | --- | --- | ---
235
- | 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**
236
- | edit | [EditHandlerOptions](#edithandleroptions) | `{ }` | Edit handler options. Set to `false` to disable handler.
237
- | remove | [DeleteHandlerOptions](#deletehandleroptions) | `{ }` | Delete handler options. Set to `false` to disable handler.
238
-
239
- <a name="edithandleroptions" />
240
- #### EditHandlerOptions
241
-
242
- | Option | Type | Default | Description
243
- | --- | --- | --- | ---
244
- | 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. If this is set to null the editable path options will not be set.
245
-
246
- <a name="deletehandleroptions" />
247
- #### DeleteHandlerOptions
248
-
249
- | Option | Type | Default | Description
250
- | --- | --- | --- | ---
251
-
252
- <a name="drawlocal" />
253
- #### Customizing language and text in Leaflet.draw
254
-
255
- Leaflet.draw uses the `L.drawLocal` configuration object to set any text used in the plugin. Customizing this will allow support for changing the text or supporting another language.
256
-
257
- See [Leaflet.draw.js](https://github.com/Leaflet/Leaflet.draw/blob/master/src/Leaflet.draw.js) for the default strings.
258
-
259
- E.g.
260
-
261
- ````js
262
- // Set the button title text for the polygon button
263
- L.drawLocal.draw.toolbar.buttons.polygon = 'Draw a sexy polygon!';
264
-
265
- // Set the tooltip start text for the rectangle
266
- L.drawLocal.draw.handlers.rectangle.tooltip.start = 'Not telling...';
267
- ````
268
-
269
- <a name="commontasks" />
270
- ## Common tasks
271
-
272
- The following examples outline some common tasks.
273
-
274
- ### Example Leaflet.draw config
275
-
276
- The following example will show you how to:
277
-
278
- 1. Change the position of the control's toolbar.
279
- 2. Customize the styles of a vector layer.
280
- 3. Use a custom marker.
281
- 4. Disable the delete functionality.
282
-
283
- ````js
284
- var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
285
- cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
286
- map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
287
-
288
- var editableLayers = new L.FeatureGroup();
289
- map.addLayer(editableLayers);
290
-
291
- var MyCustomMarker = L.Icon.extend({
292
- options: {
293
- shadowUrl: null,
294
- iconAnchor: new L.Point(12, 12),
295
- iconSize: new L.Point(24, 24),
296
- iconUrl: 'link/to/image.png'
297
- }
298
- });
299
-
300
- var options = {
301
- position: 'topright',
302
- draw: {
303
- polyline: {
304
- shapeOptions: {
305
- color: '#f357a1',
306
- weight: 10
307
- }
308
- },
309
- polygon: {
310
- allowIntersection: false, // Restricts shapes to simple polygons
311
- drawError: {
312
- color: '#e1e100', // Color the shape will turn when intersects
313
- message: '<strong>Oh snap!<strong> you can\'t draw that!' // Message that will show when intersect
314
- },
315
- shapeOptions: {
316
- color: '#bada55'
317
- }
318
- },
319
- circle: false, // Turns off this drawing tool
320
- rectangle: {
321
- shapeOptions: {
322
- clickable: false
323
- }
324
- },
325
- marker: {
326
- icon: new MyCustomMarker()
327
- }
328
- },
329
- edit: {
330
- featureGroup: editableLayers, //REQUIRED!!
331
- remove: false
332
- }
333
- };
334
-
335
- var drawControl = new L.Control.Draw(options);
336
- map.addControl(drawControl);
337
-
338
- map.on('draw:created', function (e) {
339
- var type = e.layerType,
340
- layer = e.layer;
341
-
342
- if (type === 'marker') {
343
- layer.bindPopup('A popup!');
344
- }
345
-
346
- drawnItems.addLayer(layer);
347
- });
348
- ````
349
-
350
- ### Disabling a toolbar
351
-
352
- If you do not want a particular toolbar in your app you can turn it off by setting the toolbar to false.
353
-
354
- ````js
355
- var drawControl = new L.Control.Draw({
356
- draw: false,
357
- edit: {
358
- featureGroup: editableLayers
359
- }
360
- });
361
- ````
362
-
363
- ### Disabling a toolbar item
364
-
365
- 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.
366
-
367
- ````js
368
- var drawControl = new L.Control.Draw({
369
- draw: {
370
- polygon: false,
371
- marker: false
372
- },
373
- edit: {
374
- featureGroup: editableLayers,
375
- edit: false
376
- }
377
- });
378
- ````
379
-
380
- ### Changing a drawing handlers options
381
-
382
- You can change a draw handlers options after initialization by using the `setDrawingOptions` method on the Leaflet.draw control.
383
-
384
- E.g. to change the colour of the rectangle:
385
-
386
- ````js
387
- drawControl.setDrawingOptions({
388
- rectangle: {
389
- shapeOptions: {
390
- color: '#0000FF'
391
- }
392
- }
393
- });
394
- ````
395
-
396
- ### Creating a custom build
397
-
398
- If you only require certain handlers (and not the UI), you may wish to create a custom build. You can generate the relevant jake command using the [build html file](https://github.com/Leaflet/Leaflet.draw/blob/master/build/build.html).
399
-
400
- See [edit handlers example](https://github.com/Leaflet/Leaflet.draw/blob/master/examples/edithandlers.html) which uses only the edit handlers.
401
-
402
- <a name="thanks" />
403
- ## Thanks
404
-
405
- 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.
406
-
407
- 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.
408
-
409
- The icons used for some of the toolbar buttons are either from http://glyphicons.com/ or inspired by them. <3 Glyphicons!
410
-
411
- 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.