leaflet-js 0.7.9 → 0.8.dev2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +0 -10
  3. data/Rakefile +3 -3
  4. data/leaflet-js.gemspec +7 -13
  5. data/lib/leaflet-js.rb +10 -2
  6. data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
  7. data/lib/leaflet.draw/CHANGELOG.md +130 -0
  8. data/lib/leaflet.draw/Jakefile.js +48 -0
  9. data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
  10. data/lib/leaflet.draw/README.md +427 -0
  11. data/lib/leaflet.draw/TODO.md +62 -0
  12. data/lib/leaflet.draw/build/build.html +243 -0
  13. data/lib/leaflet.draw/build/build.js +187 -0
  14. data/lib/leaflet.draw/build/deps.js +76 -0
  15. data/lib/leaflet.draw/build/hintrc.js +39 -0
  16. data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
  17. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
  18. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet.png +0 -0
  19. data/lib/leaflet.draw/dist/leaflet.draw-src.js +2872 -0
  20. data/lib/leaflet.draw/dist/leaflet.draw.css +295 -0
  21. data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
  22. data/lib/leaflet.draw/examples/basic.html +113 -0
  23. data/lib/leaflet.draw/examples/edithandlers.html +66 -0
  24. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers-2x.png +0 -0
  25. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers.png +0 -0
  26. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon-2x.png +0 -0
  27. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon.png +0 -0
  28. data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
  29. data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-shadow.png +0 -0
  30. data/lib/leaflet.draw/examples/libs/leaflet-src.js +9191 -0
  31. data/{vendor/assets/leaflet.css.erb → lib/leaflet.draw/examples/libs/leaflet.css} +2 -2
  32. data/lib/leaflet.draw/package.json +40 -0
  33. data/lib/leaflet.draw/spec/after.js +2 -0
  34. data/lib/leaflet.draw/spec/before.js +3 -0
  35. data/lib/leaflet.draw/spec/expect.js +1253 -0
  36. data/lib/leaflet.draw/spec/happen.js +93 -0
  37. data/lib/leaflet.draw/spec/index.html +38 -0
  38. data/lib/leaflet.draw/spec/karma.conf.js +72 -0
  39. data/lib/leaflet.draw/spec/sinon.js +4223 -0
  40. data/lib/leaflet.draw/spec/spec.hintrc.js +25 -0
  41. data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +14 -0
  42. data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
  43. data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +11 -0
  44. data/lib/leaflet.draw/spec/suites/SpecHelper.js +28 -0
  45. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Control.Draw.js +9 -9
  46. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Leaflet.draw.js +1 -2
  47. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Toolbar.js +0 -0
  48. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Tooltip.js +0 -0
  49. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/copyright.js +0 -0
  50. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/DrawToolbar.js +0 -4
  51. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Circle.js +1 -1
  52. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Feature.js +2 -2
  53. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
  54. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polygon.js +0 -0
  55. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polyline.js +0 -0
  56. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Rectangle.js +1 -19
  57. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +1 -7
  58. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/EditToolbar.js +2 -9
  59. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
  60. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Poly.js +2 -14
  61. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Rectangle.js +0 -0
  62. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +3 -11
  63. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +1 -4
  64. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +83 -17
  65. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/GeometryUtil.js +1 -1
  66. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LatLngUtil.js +0 -0
  67. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
  68. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
  69. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polyline.Intersect.js +0 -0
  70. data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/images/spritesheet.svg +0 -0
  71. data/lib/leaflet.label/CHANGELOG.md +67 -0
  72. data/lib/leaflet.label/Jakefile.js +21 -0
  73. data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
  74. data/lib/leaflet.label/README.md +103 -0
  75. data/lib/leaflet.label/build/build.js +155 -0
  76. data/lib/leaflet.label/build/deps.js +26 -0
  77. data/lib/leaflet.label/build/hint.js +30 -0
  78. data/lib/leaflet.label/build/hintrc.js +51 -0
  79. data/lib/leaflet.label/dist/images/death.png +0 -0
  80. data/lib/leaflet.label/dist/leaflet.label-src.js +542 -0
  81. data/{vendor/assets → lib/leaflet.label/dist}/leaflet.label.css +0 -0
  82. data/lib/leaflet.label/dist/leaflet.label.js +9 -0
  83. data/lib/leaflet.label/example/label.html +85 -0
  84. data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
  85. data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
  86. data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
  87. data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
  88. data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
  89. data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
  90. data/lib/leaflet.label/libs/leaflet/leaflet-src.js +9108 -0
  91. data/lib/leaflet.label/libs/leaflet/leaflet.css +478 -0
  92. data/lib/leaflet.label/libs/leaflet/leaflet.js +9 -0
  93. data/lib/leaflet.label/package.json +19 -0
  94. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/BaseMarkerMethods.js +0 -0
  95. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/CircleMarker.Label.js +0 -0
  96. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/FeatureGroup.Label.js +0 -0
  97. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Label.js +2 -5
  98. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Leaflet.label.js +1 -1
  99. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Map.Label.js +0 -0
  100. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Marker.Label.js +0 -0
  101. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Path.Label.js +0 -0
  102. data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/copyright.js +0 -0
  103. data/lib/leaflet/CHANGELOG.md +1007 -0
  104. data/lib/leaflet/CONTRIBUTING.md +155 -0
  105. data/lib/leaflet/FAQ.md +138 -0
  106. data/lib/leaflet/Jakefile.js +56 -0
  107. data/lib/leaflet/LICENSE +23 -0
  108. data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
  109. data/lib/leaflet/README.md +34 -0
  110. data/lib/leaflet/build/build.html +227 -0
  111. data/lib/leaflet/build/build.js +190 -0
  112. data/lib/leaflet/build/deps.js +258 -0
  113. data/lib/leaflet/build/hintrc.js +40 -0
  114. data/lib/leaflet/debug/css/mobile.css +6 -0
  115. data/lib/leaflet/debug/css/screen.css +5 -0
  116. data/lib/leaflet/debug/hacks/jitter.html +42 -0
  117. data/lib/leaflet/debug/leaflet-include.js +59 -0
  118. data/lib/leaflet/debug/map/canvas.html +49 -0
  119. data/lib/leaflet/debug/map/controls.html +49 -0
  120. data/lib/leaflet/debug/map/geolocation.html +34 -0
  121. data/lib/leaflet/debug/map/grid.html +45 -0
  122. data/lib/leaflet/debug/map/iframe.html +11 -0
  123. data/lib/leaflet/debug/map/image-overlay.html +43 -0
  124. data/lib/leaflet/debug/map/map-mobile.html +34 -0
  125. data/lib/leaflet/debug/map/map.html +61 -0
  126. data/lib/leaflet/debug/map/max-bounds.html +38 -0
  127. data/lib/leaflet/debug/map/opacity.html +223 -0
  128. data/lib/leaflet/debug/map/scroll.html +41 -0
  129. data/lib/leaflet/debug/map/simple-proj.html +59 -0
  130. data/lib/leaflet/debug/map/wms-marble.html +30 -0
  131. data/lib/leaflet/debug/map/wms.html +40 -0
  132. data/lib/leaflet/debug/map/zoomlevels.html +45 -0
  133. data/lib/leaflet/debug/tests/add_remove_layers.html +87 -0
  134. data/lib/leaflet/debug/tests/bringtoback.html +37 -0
  135. data/lib/leaflet/debug/tests/canvasloop.html +47 -0
  136. data/lib/leaflet/debug/tests/click_on_canvas.html +58 -0
  137. data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
  138. data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
  139. data/lib/leaflet/debug/tests/opacity.html +56 -0
  140. data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
  141. data/lib/leaflet/debug/tests/remove_while_dragging.html +28 -0
  142. data/lib/leaflet/debug/tests/removetilewhilepan.html +41 -0
  143. data/lib/leaflet/debug/tests/reuse_popups.html +40 -0
  144. data/lib/leaflet/debug/tests/rtl.html +42 -0
  145. data/lib/leaflet/debug/tests/rtl2.html +27 -0
  146. data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
  147. data/lib/leaflet/debug/tests/svg_clicks.html +54 -0
  148. data/lib/leaflet/debug/vector/bounds-extend.html +88 -0
  149. data/lib/leaflet/debug/vector/feature-group-bounds.html +90 -0
  150. data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
  151. data/lib/leaflet/debug/vector/geojson.html +173 -0
  152. data/lib/leaflet/debug/vector/rectangle.html +53 -0
  153. data/lib/leaflet/debug/vector/route.js +1 -0
  154. data/lib/leaflet/debug/vector/touchzoomemu.html +194 -0
  155. data/lib/leaflet/debug/vector/us-states.js +54 -0
  156. data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
  157. data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
  158. data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
  159. data/lib/leaflet/debug/vector/vector-simple.html +47 -0
  160. data/lib/leaflet/debug/vector/vector.html +37 -0
  161. data/lib/leaflet/debug/vector/vector2.html +58 -0
  162. data/lib/leaflet/dist/images/layers-2x.png +0 -0
  163. data/lib/leaflet/dist/images/layers.png +0 -0
  164. data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
  165. data/lib/leaflet/dist/images/marker-icon.png +0 -0
  166. data/lib/leaflet/dist/images/marker-shadow.png +0 -0
  167. data/lib/leaflet/dist/leaflet.css +494 -0
  168. data/lib/leaflet/package.json +28 -0
  169. data/lib/leaflet/spec/after.js +2 -0
  170. data/lib/leaflet/spec/expect.js +1253 -0
  171. data/lib/leaflet/spec/index.html +87 -0
  172. data/lib/leaflet/spec/karma.conf.js +68 -0
  173. data/lib/leaflet/spec/sinon.js +4223 -0
  174. data/lib/leaflet/spec/spec.hintrc.js +25 -0
  175. data/lib/leaflet/spec/suites/SpecHelper.js +42 -0
  176. data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
  177. data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
  178. data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
  179. data/lib/leaflet/spec/suites/core/ClassSpec.js +166 -0
  180. data/lib/leaflet/spec/suites/core/EventsSpec.js +416 -0
  181. data/lib/leaflet/spec/suites/core/UtilSpec.js +237 -0
  182. data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
  183. data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
  184. data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
  185. data/lib/leaflet/spec/suites/geo/CRSSpec.js +151 -0
  186. data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +144 -0
  187. data/lib/leaflet/spec/suites/geo/LatLngSpec.js +102 -0
  188. data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +96 -0
  189. data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
  190. data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
  191. data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
  192. data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
  193. data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
  194. data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +86 -0
  195. data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +282 -0
  196. data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +71 -0
  197. data/lib/leaflet/spec/suites/layer/PopupSpec.js +119 -0
  198. data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +117 -0
  199. data/lib/leaflet/spec/suites/layer/tile/GridLayerSpec.js +70 -0
  200. data/lib/leaflet/spec/suites/layer/tile/TileLayerSpec.js +88 -0
  201. data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
  202. data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +18 -0
  203. data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +96 -0
  204. data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
  205. data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
  206. data/lib/leaflet/spec/suites/map/MapSpec.js +553 -0
  207. data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
  208. data/{vendor/assets/Leaflet → lib/leaflet}/src/Leaflet.js +16 -11
  209. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Attribution.js +1 -23
  210. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Layers.js +42 -57
  211. data/lib/leaflet/src/control/Control.Scale.js +102 -0
  212. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Zoom.js +11 -18
  213. data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.js +7 -9
  214. data/lib/leaflet/src/copyright.js +4 -0
  215. data/lib/leaflet/src/core/Browser.js +65 -0
  216. data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Class.js +8 -13
  217. data/lib/leaflet/src/core/Events.js +226 -0
  218. data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Handler.js +0 -0
  219. data/lib/leaflet/src/core/Util.js +196 -0
  220. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.DoubleTap.js +20 -27
  221. data/lib/leaflet/src/dom/DomEvent.Pointer.js +107 -0
  222. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.js +70 -59
  223. data/lib/leaflet/src/dom/DomUtil.js +213 -0
  224. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/Draggable.js +10 -19
  225. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.Timer.js +0 -0
  226. data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.js +4 -3
  227. data/lib/leaflet/src/geo/LatLng.js +67 -0
  228. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/LatLngBounds.js +0 -0
  229. data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
  230. data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
  231. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.EPSG4326.js +2 -3
  232. data/lib/leaflet/src/geo/crs/CRS.Earth.js +19 -0
  233. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.Simple.js +10 -1
  234. data/lib/leaflet/src/geo/crs/CRS.js +63 -0
  235. data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/projection/Projection.LonLat.js +5 -1
  236. data/lib/leaflet/src/geo/projection/Projection.Mercator.js +43 -0
  237. data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +31 -0
  238. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Bounds.js +0 -0
  239. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/LineUtil.js +16 -5
  240. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Point.js +10 -0
  241. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/PolyUtil.js +0 -0
  242. data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Transformation.js +0 -0
  243. data/{vendor/assets/Leaflet → lib/leaflet}/src/images/layers.svg +0 -0
  244. data/lib/leaflet/src/images/logo.svg +85 -0
  245. data/{vendor/assets/Leaflet → lib/leaflet}/src/images/marker.svg +0 -0
  246. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/FeatureGroup.js +3 -20
  247. data/lib/leaflet/src/layer/GeoJSON.js +275 -0
  248. data/lib/leaflet/src/layer/ImageOverlay.js +123 -0
  249. data/lib/leaflet/src/layer/Layer.Popup.js +87 -0
  250. data/lib/leaflet/src/layer/Layer.js +150 -0
  251. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/LayerGroup.js +12 -14
  252. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/Popup.js +65 -83
  253. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/DivIcon.js +3 -8
  254. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.Default.js +6 -12
  255. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.js +8 -25
  256. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.Drag.js +13 -11
  257. data/lib/leaflet/src/layer/marker/Marker.Popup.js +16 -0
  258. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.js +52 -103
  259. data/lib/leaflet/src/layer/tile/GridLayer.js +536 -0
  260. data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +79 -0
  261. data/lib/leaflet/src/layer/tile/TileLayer.js +148 -0
  262. data/lib/leaflet/src/layer/vector/Canvas.js +292 -0
  263. data/lib/leaflet/src/layer/vector/Circle.js +67 -0
  264. data/lib/leaflet/src/layer/vector/CircleMarker.js +72 -0
  265. data/lib/leaflet/src/layer/vector/Path.js +79 -0
  266. data/lib/leaflet/src/layer/vector/Polygon.js +75 -0
  267. data/lib/leaflet/src/layer/vector/Polyline.js +223 -0
  268. data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/vector/Rectangle.js +27 -27
  269. data/lib/leaflet/src/layer/vector/Renderer.js +75 -0
  270. data/lib/leaflet/src/layer/vector/SVG.VML.js +134 -0
  271. data/lib/leaflet/src/layer/vector/SVG.js +189 -0
  272. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/Map.js +83 -199
  273. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
  274. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.ZoomAnimation.js +30 -38
  275. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/ext/Map.Geolocation.js +8 -8
  276. data/lib/leaflet/src/map/handler/Map.BoxZoom.js +105 -0
  277. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
  278. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Drag.js +12 -10
  279. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Keyboard.js +19 -17
  280. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.ScrollWheelZoom.js +10 -6
  281. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Tap.js +8 -6
  282. data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.TouchZoom.js +16 -32
  283. data/vendor/assets/images/layers-2x.png +0 -0
  284. data/vendor/assets/images/layers.png +0 -0
  285. data/vendor/assets/images/marker-icon-2x.png +0 -0
  286. data/vendor/assets/images/marker-icon.png +0 -0
  287. data/vendor/assets/images/marker-shadow.png +0 -0
  288. data/vendor/assets/images/spritesheet-2x.png +0 -0
  289. data/vendor/assets/images/spritesheet.png +0 -0
  290. data/vendor/assets/{leaflet-js.js → javascripts/leaflet-js.js} +2 -2
  291. data/vendor/assets/javascripts/leaflet.draw.js +37 -0
  292. data/vendor/assets/javascripts/leaflet.js +149 -0
  293. data/vendor/assets/javascripts/leaflet.label.js +11 -0
  294. data/vendor/assets/{leaflet-js.css → stylesheets/leaflet-js.css} +0 -0
  295. data/vendor/assets/stylesheets/leaflet.css.erb +478 -0
  296. data/vendor/assets/{leaflet.draw.css.erb → stylesheets/leaflet.draw.css.erb} +2 -2
  297. data/vendor/assets/{leaflet.draw.ie.css → stylesheets/leaflet.draw.ie.css} +0 -0
  298. data/vendor/assets/stylesheets/leaflet.label.css +52 -0
  299. metadata +298 -137
  300. data/lib/leaflet-js/engine.rb +0 -7
  301. data/lib/leaflet-js/version.rb +0 -3
  302. data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +0 -75
  303. data/vendor/assets/Leaflet/src/control/Control.Scale.js +0 -112
  304. data/vendor/assets/Leaflet/src/copyright.js +0 -5
  305. data/vendor/assets/Leaflet/src/core/Browser.js +0 -66
  306. data/vendor/assets/Leaflet/src/core/Events.js +0 -178
  307. data/vendor/assets/Leaflet/src/core/Util.js +0 -182
  308. data/vendor/assets/Leaflet/src/dom/DomEvent.Pointer.js +0 -156
  309. data/vendor/assets/Leaflet/src/dom/DomUtil.js +0 -289
  310. data/vendor/assets/Leaflet/src/geo/LatLng.js +0 -99
  311. data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3395.js +0 -14
  312. data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3857.js +0 -21
  313. data/vendor/assets/Leaflet/src/geo/crs/CRS.js +0 -32
  314. data/vendor/assets/Leaflet/src/geo/projection/Projection.Mercator.js +0 -56
  315. data/vendor/assets/Leaflet/src/geo/projection/Projection.SphericalMercator.js +0 -27
  316. data/vendor/assets/Leaflet/src/geo/projection/Projection.js +0 -5
  317. data/vendor/assets/Leaflet/src/layer/GeoJSON.js +0 -286
  318. data/vendor/assets/Leaflet/src/layer/ImageOverlay.js +0 -141
  319. data/vendor/assets/Leaflet/src/layer/marker/Marker.Popup.js +0 -90
  320. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Anim.js +0 -110
  321. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Canvas.js +0 -61
  322. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.WMS.js +0 -87
  323. data/vendor/assets/Leaflet/src/layer/tile/TileLayer.js +0 -597
  324. data/vendor/assets/Leaflet/src/layer/vector/Circle.js +0 -98
  325. data/vendor/assets/Leaflet/src/layer/vector/CircleMarker.js +0 -45
  326. data/vendor/assets/Leaflet/src/layer/vector/MultiPoly.js +0 -57
  327. data/vendor/assets/Leaflet/src/layer/vector/Path.Popup.js +0 -65
  328. data/vendor/assets/Leaflet/src/layer/vector/Path.SVG.js +0 -230
  329. data/vendor/assets/Leaflet/src/layer/vector/Path.VML.js +0 -135
  330. data/vendor/assets/Leaflet/src/layer/vector/Path.js +0 -119
  331. data/vendor/assets/Leaflet/src/layer/vector/Polygon.js +0 -92
  332. data/vendor/assets/Leaflet/src/layer/vector/Polyline.js +0 -164
  333. data/vendor/assets/Leaflet/src/layer/vector/canvas/Circle.Canvas.js +0 -18
  334. data/vendor/assets/Leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -9
  335. data/vendor/assets/Leaflet/src/layer/vector/canvas/Path.Canvas.js +0 -204
  336. data/vendor/assets/Leaflet/src/layer/vector/canvas/Polygon.Canvas.js +0 -37
  337. data/vendor/assets/Leaflet/src/layer/vector/canvas/Polyline.Canvas.js +0 -30
  338. data/vendor/assets/Leaflet/src/map/handler/Map.BoxZoom.js +0 -118
  339. data/vendor/assets/leaflet.draw.js +0 -38
  340. data/vendor/assets/leaflet.js +0 -155
  341. data/vendor/assets/leaflet.label.js +0 -11
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Adds popup-related methods to all layers.
3
+ */
4
+
5
+ L.Layer.include({
6
+
7
+ bindPopup: function (content, options) {
8
+
9
+ if (content instanceof L.Popup) {
10
+ this._popup = content;
11
+ content._source = this;
12
+ } else {
13
+ if (!this._popup || options) {
14
+ this._popup = new L.Popup(options, this);
15
+ }
16
+ this._popup.setContent(content);
17
+ }
18
+
19
+ if (!this._popupHandlersAdded) {
20
+ this.on({
21
+ click: this._openPopup,
22
+ remove: this.closePopup,
23
+ move: this._movePopup
24
+ });
25
+ this._popupHandlersAdded = true;
26
+ }
27
+
28
+ return this;
29
+ },
30
+
31
+ unbindPopup: function () {
32
+ if (this._popup) {
33
+ this.on({
34
+ click: this._openPopup,
35
+ remove: this.closePopup,
36
+ move: this._movePopup
37
+ });
38
+ this._popupHandlersAdded = false;
39
+ this._popup = null;
40
+ }
41
+ return this;
42
+ },
43
+
44
+ openPopup: function (latlng) {
45
+ if (this._popup && this._map) {
46
+ this._map.openPopup(this._popup, latlng || this._latlng || this.getCenter());
47
+ }
48
+ return this;
49
+ },
50
+
51
+ closePopup: function () {
52
+ if (this._popup) {
53
+ this._popup._close();
54
+ }
55
+ return this;
56
+ },
57
+
58
+ togglePopup: function () {
59
+ if (this._popup) {
60
+ if (this._popup._map) {
61
+ this.closePopup();
62
+ } else {
63
+ this.openPopup();
64
+ }
65
+ }
66
+ return this;
67
+ },
68
+
69
+ setPopupContent: function (content) {
70
+ if (this._popup) {
71
+ this._popup.setContent(content);
72
+ }
73
+ return this;
74
+ },
75
+
76
+ getPopup: function () {
77
+ return this._popup;
78
+ },
79
+
80
+ _openPopup: function (e) {
81
+ this._map.openPopup(this._popup, e.latlng);
82
+ },
83
+
84
+ _movePopup: function (e) {
85
+ this._popup.setLatLng(e.latlng);
86
+ }
87
+ });
@@ -0,0 +1,150 @@
1
+
2
+ L.Layer = L.Evented.extend({
3
+
4
+ options: {
5
+ pane: 'overlayPane'
6
+ },
7
+
8
+ addTo: function (map) {
9
+ var id = L.stamp(this);
10
+ if (map._layers[id]) { return this; }
11
+ map._layers[id] = this;
12
+
13
+ this._zoomAnimated = map._zoomAnimated;
14
+
15
+ if (this.beforeAdd) {
16
+ this.beforeAdd(map);
17
+ }
18
+
19
+ this._mapToAdd = map;
20
+ map.whenReady(this._layerAdd, this);
21
+
22
+ return this;
23
+ },
24
+
25
+ _layerAdd: function () {
26
+ var map = this._mapToAdd;
27
+
28
+ // check in case layer gets added and then removed before the map is ready
29
+ if (!map) { return; }
30
+
31
+ this._map = map;
32
+ this._mapToAdd = null;
33
+
34
+ this.onAdd(map);
35
+
36
+ if (this.getAttribution && this._map.attributionControl) {
37
+ this._map.attributionControl.addAttribution(this.getAttribution());
38
+ }
39
+
40
+ if (this.getEvents) {
41
+ map.on(this.getEvents(), this);
42
+ }
43
+
44
+ this.fire('add');
45
+ map.fire('layeradd', {layer: this});
46
+ },
47
+
48
+ remove: function () {
49
+
50
+ var id = L.stamp(this),
51
+ map = this._map || this._mapToAdd;
52
+
53
+ if (!map || !map._layers[id]) { return this; }
54
+
55
+ if (map._loaded) {
56
+ this.onRemove(map);
57
+ }
58
+
59
+ if (this.getAttribution && this._map.attributionControl) {
60
+ this._map.attributionControl.removeAttribution(this.getAttribution());
61
+ }
62
+
63
+ if (this.getEvents) {
64
+ map.off(this.getEvents(), this);
65
+ }
66
+
67
+ delete map._layers[id];
68
+
69
+ if (map._loaded) {
70
+ map.fire('layerremove', {layer: this});
71
+ this.fire('remove');
72
+ }
73
+
74
+ this._map = this._mapToAdd = null;
75
+
76
+ return this;
77
+ },
78
+
79
+ getPane: function (name) {
80
+ return this._map.getPane(name ? (this.options[name] || name) : this.options.pane);
81
+ }
82
+ });
83
+
84
+
85
+ L.Map.include({
86
+ addLayer: function (layer) {
87
+ layer.addTo(this);
88
+ return this;
89
+ },
90
+
91
+ removeLayer: function (layer) {
92
+ layer.remove();
93
+ return this;
94
+ },
95
+
96
+ hasLayer: function (layer) {
97
+ return !!layer && (L.stamp(layer) in this._layers);
98
+ },
99
+
100
+ eachLayer: function (method, context) {
101
+ for (var i in this._layers) {
102
+ method.call(context, this._layers[i]);
103
+ }
104
+ return this;
105
+ },
106
+
107
+ _addLayers: function (layers) {
108
+ layers = layers ? (L.Util.isArray(layers) ? layers : [layers]) : [];
109
+
110
+ for (var i = 0, len = layers.length; i < len; i++) {
111
+ this.addLayer(layers[i]);
112
+ }
113
+ },
114
+
115
+ _addZoomLimit: function (layer) {
116
+ if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {
117
+ this._zoomBoundLayers[L.stamp(layer)] = layer;
118
+ this._updateZoomLevels();
119
+ }
120
+ },
121
+
122
+ _removeZoomLimit: function (layer) {
123
+ var id = L.stamp(layer);
124
+
125
+ if (this._zoomBoundLayers[id]) {
126
+ delete this._zoomBoundLayers[id];
127
+ this._updateZoomLevels();
128
+ }
129
+ },
130
+
131
+ _updateZoomLevels: function () {
132
+ var minZoom = Infinity,
133
+ maxZoom = -Infinity,
134
+ oldZoomSpan = this._getZoomSpan();
135
+
136
+ for (var i in this._zoomBoundLayers) {
137
+ var options = this._zoomBoundLayers[i].options;
138
+
139
+ minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);
140
+ maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);
141
+ }
142
+
143
+ this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;
144
+ this._layersMinZoom = minZoom === Infinity ? undefined : minZoom;
145
+
146
+ if (oldZoomSpan !== this._getZoomSpan()) {
147
+ this.fire('zoomlevelschange');
148
+ }
149
+ }
150
+ });
@@ -3,7 +3,8 @@
3
3
  * you can manipulate the group (e.g. add/remove it) as one layer.
4
4
  */
5
5
 
6
- L.LayerGroup = L.Class.extend({
6
+ L.LayerGroup = L.Layer.extend({
7
+
7
8
  initialize: function (layers) {
8
9
  this._layers = {};
9
10
 
@@ -41,13 +42,13 @@ L.LayerGroup = L.Class.extend({
41
42
  },
42
43
 
43
44
  hasLayer: function (layer) {
44
- if (!layer) { return false; }
45
-
46
- return (layer in this._layers || this.getLayerId(layer) in this._layers);
45
+ return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers);
47
46
  },
48
47
 
49
48
  clearLayers: function () {
50
- this.eachLayer(this.removeLayer, this);
49
+ for (var i in this._layers) {
50
+ this.removeLayer(this._layers[i]);
51
+ }
51
52
  return this;
52
53
  },
53
54
 
@@ -67,18 +68,15 @@ L.LayerGroup = L.Class.extend({
67
68
  },
68
69
 
69
70
  onAdd: function (map) {
70
- this._map = map;
71
- this.eachLayer(map.addLayer, map);
71
+ for (var i in this._layers) {
72
+ map.addLayer(this._layers[i]);
73
+ }
72
74
  },
73
75
 
74
76
  onRemove: function (map) {
75
- this.eachLayer(map.removeLayer, map);
76
- this._map = null;
77
- },
78
-
79
- addTo: function (map) {
80
- map.addLayer(this);
81
- return this;
77
+ for (var i in this._layers) {
78
+ map.removeLayer(this._layers[i]);
79
+ }
82
80
  },
83
81
 
84
82
  eachLayer: function (method, context) {
@@ -6,21 +6,24 @@ L.Map.mergeOptions({
6
6
  closePopupOnClick: true
7
7
  });
8
8
 
9
- L.Popup = L.Class.extend({
10
- includes: L.Mixin.Events,
9
+ L.Popup = L.Layer.extend({
11
10
 
12
11
  options: {
12
+ pane: 'popupPane',
13
+
13
14
  minWidth: 50,
14
15
  maxWidth: 300,
15
- // maxHeight: null,
16
- autoPan: true,
17
- closeButton: true,
16
+ // maxHeight: <Number>,
18
17
  offset: [0, 7],
18
+
19
+ autoPan: true,
19
20
  autoPanPadding: [5, 5],
20
- // autoPanPaddingTopLeft: null,
21
- // autoPanPaddingBottomRight: null,
22
- keepInView: false,
23
- className: '',
21
+ // autoPanPaddingTopLeft: <Point>,
22
+ // autoPanPaddingBottomRight: <Point>,
23
+
24
+ closeButton: true,
25
+ // keepInView: false,
26
+ // className: '',
24
27
  zoomAnimation: true
25
28
  },
26
29
 
@@ -28,70 +31,51 @@ L.Popup = L.Class.extend({
28
31
  L.setOptions(this, options);
29
32
 
30
33
  this._source = source;
31
- this._animated = L.Browser.any3d && this.options.zoomAnimation;
32
- this._isOpen = false;
33
34
  },
34
35
 
35
36
  onAdd: function (map) {
36
- this._map = map;
37
+ this._zoomAnimated = this._zoomAnimated && this.options.zoomAnimation;
37
38
 
38
39
  if (!this._container) {
39
40
  this._initLayout();
40
41
  }
41
42
 
42
- var animFade = map.options.fadeAnimation;
43
-
44
- if (animFade) {
43
+ if (map._fadeAnimated) {
45
44
  L.DomUtil.setOpacity(this._container, 0);
46
45
  }
47
- map._panes.popupPane.appendChild(this._container);
48
-
49
- map.on(this._getEvents(), this);
50
46
 
47
+ clearTimeout(this._removeTimeout);
48
+ this.getPane().appendChild(this._container);
51
49
  this.update();
52
50
 
53
- if (animFade) {
51
+ if (map._fadeAnimated) {
54
52
  L.DomUtil.setOpacity(this._container, 1);
55
53
  }
56
54
 
57
- this.fire('open');
58
-
59
55
  map.fire('popupopen', {popup: this});
60
56
 
61
57
  if (this._source) {
62
- this._source.fire('popupopen', {popup: this});
58
+ this._source.fire('popupopen', {popup: this}, true);
63
59
  }
64
60
  },
65
61
 
66
- addTo: function (map) {
67
- map.addLayer(this);
68
- return this;
69
- },
70
-
71
62
  openOn: function (map) {
72
63
  map.openPopup(this);
73
64
  return this;
74
65
  },
75
66
 
76
67
  onRemove: function (map) {
77
- map._panes.popupPane.removeChild(this._container);
78
-
79
- L.Util.falseFn(this._container.offsetWidth); // force reflow
80
-
81
- map.off(this._getEvents(), this);
82
-
83
- if (map.options.fadeAnimation) {
68
+ if (map._fadeAnimated) {
84
69
  L.DomUtil.setOpacity(this._container, 0);
70
+ this._removeTimeout = setTimeout(L.bind(L.DomUtil.remove, L.DomUtil, this._container), 200);
71
+ } else {
72
+ L.DomUtil.remove(this._container);
85
73
  }
86
74
 
87
- this._map = null;
88
-
89
- this.fire('close');
90
-
91
75
  map.fire('popupclose', {popup: this});
92
76
 
93
77
  if (this._source) {
94
- this._source.fire('popupclose', {popup: this});
78
+ this._source.fire('popupclose', {popup: this}, true);
95
79
  }
96
80
  },
97
81
 
@@ -132,21 +116,19 @@ L.Popup = L.Class.extend({
132
116
  this._adjustPan();
133
117
  },
134
118
 
135
- _getEvents: function () {
136
- var events = {
137
- viewreset: this._updatePosition
138
- };
119
+ getEvents: function () {
120
+ var events = {viewreset: this._updatePosition},
121
+ options = this.options;
139
122
 
140
- if (this._animated) {
141
- events.zoomanim = this._zoomAnimation;
123
+ if (this._zoomAnimated) {
124
+ events.zoomanim = this._animateZoom;
142
125
  }
143
- if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
126
+ if ('closeOnClick' in options ? options.closeOnClick : this._map.options.closePopupOnClick) {
144
127
  events.preclick = this._close;
145
128
  }
146
- if (this.options.keepInView) {
129
+ if (options.keepInView) {
147
130
  events.moveend = this._adjustPan;
148
131
  }
149
-
150
132
  return events;
151
133
  },
152
134
 
@@ -158,29 +140,25 @@ L.Popup = L.Class.extend({
158
140
 
159
141
  _initLayout: function () {
160
142
  var prefix = 'leaflet-popup',
161
- containerClass = prefix + ' ' + this.options.className + ' leaflet-zoom-' +
162
- (this._animated ? 'animated' : 'hide'),
163
- container = this._container = L.DomUtil.create('div', containerClass),
164
- closeButton;
143
+ container = this._container = L.DomUtil.create('div',
144
+ prefix + ' ' + (this.options.className || '') +
145
+ ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'));
165
146
 
166
147
  if (this.options.closeButton) {
167
- closeButton = this._closeButton =
168
- L.DomUtil.create('a', prefix + '-close-button', container);
148
+ var closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button', container);
169
149
  closeButton.href = '#close';
170
150
  closeButton.innerHTML = '&#215;';
171
- L.DomEvent.disableClickPropagation(closeButton);
172
151
 
173
152
  L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
174
153
  }
175
154
 
176
- var wrapper = this._wrapper =
177
- L.DomUtil.create('div', prefix + '-content-wrapper', container);
178
- L.DomEvent.disableClickPropagation(wrapper);
179
-
155
+ var wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper', container);
180
156
  this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);
181
157
 
182
- L.DomEvent.disableScrollPropagation(this._contentNode);
183
- L.DomEvent.on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);
158
+ L.DomEvent
159
+ .disableClickPropagation(wrapper)
160
+ .disableScrollPropagation(this._contentNode)
161
+ .on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);
184
162
 
185
163
  this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
186
164
  this._tip = L.DomUtil.create('div', prefix + '-tip', this._tipContainer);
@@ -189,13 +167,15 @@ L.Popup = L.Class.extend({
189
167
  _updateContent: function () {
190
168
  if (!this._content) { return; }
191
169
 
170
+ var node = this._contentNode;
171
+
192
172
  if (typeof this._content === 'string') {
193
- this._contentNode.innerHTML = this._content;
173
+ node.innerHTML = this._content;
194
174
  } else {
195
- while (this._contentNode.hasChildNodes()) {
196
- this._contentNode.removeChild(this._contentNode.firstChild);
175
+ while (node.hasChildNodes()) {
176
+ node.removeChild(node.firstChild);
197
177
  }
198
- this._contentNode.appendChild(this._content);
178
+ node.appendChild(this._content);
199
179
  }
200
180
  this.fire('contentupdate');
201
181
  },
@@ -234,24 +214,24 @@ L.Popup = L.Class.extend({
234
214
  if (!this._map) { return; }
235
215
 
236
216
  var pos = this._map.latLngToLayerPoint(this._latlng),
237
- animated = this._animated,
238
217
  offset = L.point(this.options.offset);
239
218
 
240
- if (animated) {
219
+ if (this._zoomAnimated) {
241
220
  L.DomUtil.setPosition(this._container, pos);
221
+ } else {
222
+ offset = offset.add(pos);
242
223
  }
243
224
 
244
- this._containerBottom = -offset.y - (animated ? 0 : pos.y);
245
- this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x + (animated ? 0 : pos.x);
225
+ var bottom = this._containerBottom = -offset.y,
226
+ left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;
246
227
 
247
228
  // bottom position the popup in case the height of the popup changes (images loading etc)
248
- this._container.style.bottom = this._containerBottom + 'px';
249
- this._container.style.left = this._containerLeft + 'px';
229
+ this._container.style.bottom = bottom + 'px';
230
+ this._container.style.left = left + 'px';
250
231
  },
251
232
 
252
- _zoomAnimation: function (opt) {
253
- var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center);
254
-
233
+ _animateZoom: function (e) {
234
+ var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
255
235
  L.DomUtil.setPosition(this._container, pos);
256
236
  },
257
237
 
@@ -261,10 +241,9 @@ L.Popup = L.Class.extend({
261
241
  var map = this._map,
262
242
  containerHeight = this._container.offsetHeight,
263
243
  containerWidth = this._containerWidth,
264
-
265
244
  layerPos = new L.Point(this._containerLeft, -containerHeight - this._containerBottom);
266
245
 
267
- if (this._animated) {
246
+ if (this._zoomAnimated) {
268
247
  layerPos._add(L.DomUtil.getPosition(this._container));
269
248
  }
270
249
 
@@ -309,17 +288,21 @@ L.popup = function (options, source) {
309
288
 
310
289
  L.Map.include({
311
290
  openPopup: function (popup, latlng, options) { // (Popup) or (String || HTMLElement, LatLng[, Object])
312
- this.closePopup();
313
-
314
291
  if (!(popup instanceof L.Popup)) {
315
292
  var content = popup;
316
293
 
317
- popup = new L.Popup(options)
318
- .setLatLng(latlng)
319
- .setContent(content);
294
+ popup = new L.Popup(options).setContent(content);
295
+ }
296
+
297
+ if (latlng) {
298
+ popup.setLatLng(latlng);
299
+ }
300
+
301
+ if (this.hasLayer(popup)) {
302
+ return this;
320
303
  }
321
- popup._isOpen = true;
322
304
 
305
+ this.closePopup();
323
306
  this._popup = popup;
324
307
  return this.addLayer(popup);
325
308
  },
@@ -331,7 +314,6 @@ L.Map.include({
331
314
  }
332
315
  if (popup) {
333
316
  this.removeLayer(popup);
334
- popup._isOpen = false;
335
317
  }
336
318
  return this;
337
319
  }