leaflet-js 0.7.9 → 0.8.dev2

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