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.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +0 -10
- data/Rakefile +3 -3
- data/leaflet-js.gemspec +7 -13
- data/lib/leaflet-js.rb +10 -2
- data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
- data/lib/leaflet.draw/CHANGELOG.md +130 -0
- data/lib/leaflet.draw/Jakefile.js +48 -0
- data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.draw/README.md +427 -0
- data/lib/leaflet.draw/TODO.md +62 -0
- data/lib/leaflet.draw/build/build.html +243 -0
- data/lib/leaflet.draw/build/build.js +187 -0
- data/lib/leaflet.draw/build/deps.js +76 -0
- data/lib/leaflet.draw/build/hintrc.js +39 -0
- data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +2872 -0
- data/lib/leaflet.draw/dist/leaflet.draw.css +295 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
- data/lib/leaflet.draw/examples/basic.html +113 -0
- data/lib/leaflet.draw/examples/edithandlers.html +66 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers-2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon-2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-shadow.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +9191 -0
- data/{vendor/assets/leaflet.css.erb → lib/leaflet.draw/examples/libs/leaflet.css} +2 -2
- data/lib/leaflet.draw/package.json +40 -0
- data/lib/leaflet.draw/spec/after.js +2 -0
- data/lib/leaflet.draw/spec/before.js +3 -0
- data/lib/leaflet.draw/spec/expect.js +1253 -0
- data/lib/leaflet.draw/spec/happen.js +93 -0
- data/lib/leaflet.draw/spec/index.html +38 -0
- data/lib/leaflet.draw/spec/karma.conf.js +72 -0
- data/lib/leaflet.draw/spec/sinon.js +4223 -0
- data/lib/leaflet.draw/spec/spec.hintrc.js +25 -0
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +14 -0
- data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
- data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +11 -0
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +28 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Control.Draw.js +9 -9
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Leaflet.draw.js +1 -2
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Toolbar.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Tooltip.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/copyright.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/DrawToolbar.js +0 -4
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Circle.js +1 -1
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Feature.js +2 -2
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polygon.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polyline.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Rectangle.js +1 -19
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +1 -7
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/EditToolbar.js +2 -9
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Poly.js +2 -14
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Rectangle.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +3 -11
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +1 -4
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +83 -17
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/GeometryUtil.js +1 -1
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LatLngUtil.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polyline.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/images/spritesheet.svg +0 -0
- data/lib/leaflet.label/CHANGELOG.md +67 -0
- data/lib/leaflet.label/Jakefile.js +21 -0
- data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.label/README.md +103 -0
- data/lib/leaflet.label/build/build.js +155 -0
- data/lib/leaflet.label/build/deps.js +26 -0
- data/lib/leaflet.label/build/hint.js +30 -0
- data/lib/leaflet.label/build/hintrc.js +51 -0
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +542 -0
- data/{vendor/assets → lib/leaflet.label/dist}/leaflet.label.css +0 -0
- data/lib/leaflet.label/dist/leaflet.label.js +9 -0
- data/lib/leaflet.label/example/label.html +85 -0
- data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +9108 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.css +478 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.js +9 -0
- data/lib/leaflet.label/package.json +19 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/BaseMarkerMethods.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/CircleMarker.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/FeatureGroup.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Label.js +2 -5
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Leaflet.label.js +1 -1
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Map.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Marker.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Path.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/copyright.js +0 -0
- data/lib/leaflet/CHANGELOG.md +1007 -0
- data/lib/leaflet/CONTRIBUTING.md +155 -0
- data/lib/leaflet/FAQ.md +138 -0
- data/lib/leaflet/Jakefile.js +56 -0
- data/lib/leaflet/LICENSE +23 -0
- data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
- data/lib/leaflet/README.md +34 -0
- data/lib/leaflet/build/build.html +227 -0
- data/lib/leaflet/build/build.js +190 -0
- data/lib/leaflet/build/deps.js +258 -0
- data/lib/leaflet/build/hintrc.js +40 -0
- data/lib/leaflet/debug/css/mobile.css +6 -0
- data/lib/leaflet/debug/css/screen.css +5 -0
- data/lib/leaflet/debug/hacks/jitter.html +42 -0
- data/lib/leaflet/debug/leaflet-include.js +59 -0
- data/lib/leaflet/debug/map/canvas.html +49 -0
- data/lib/leaflet/debug/map/controls.html +49 -0
- data/lib/leaflet/debug/map/geolocation.html +34 -0
- data/lib/leaflet/debug/map/grid.html +45 -0
- data/lib/leaflet/debug/map/iframe.html +11 -0
- data/lib/leaflet/debug/map/image-overlay.html +43 -0
- data/lib/leaflet/debug/map/map-mobile.html +34 -0
- data/lib/leaflet/debug/map/map.html +61 -0
- data/lib/leaflet/debug/map/max-bounds.html +38 -0
- data/lib/leaflet/debug/map/opacity.html +223 -0
- data/lib/leaflet/debug/map/scroll.html +41 -0
- data/lib/leaflet/debug/map/simple-proj.html +59 -0
- data/lib/leaflet/debug/map/wms-marble.html +30 -0
- data/lib/leaflet/debug/map/wms.html +40 -0
- data/lib/leaflet/debug/map/zoomlevels.html +45 -0
- data/lib/leaflet/debug/tests/add_remove_layers.html +87 -0
- data/lib/leaflet/debug/tests/bringtoback.html +37 -0
- data/lib/leaflet/debug/tests/canvasloop.html +47 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +58 -0
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
- data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
- data/lib/leaflet/debug/tests/opacity.html +56 -0
- data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +28 -0
- data/lib/leaflet/debug/tests/removetilewhilepan.html +41 -0
- data/lib/leaflet/debug/tests/reuse_popups.html +40 -0
- data/lib/leaflet/debug/tests/rtl.html +42 -0
- data/lib/leaflet/debug/tests/rtl2.html +27 -0
- data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +54 -0
- data/lib/leaflet/debug/vector/bounds-extend.html +88 -0
- data/lib/leaflet/debug/vector/feature-group-bounds.html +90 -0
- data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
- data/lib/leaflet/debug/vector/geojson.html +173 -0
- data/lib/leaflet/debug/vector/rectangle.html +53 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/touchzoomemu.html +194 -0
- data/lib/leaflet/debug/vector/us-states.js +54 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
- data/lib/leaflet/debug/vector/vector-simple.html +47 -0
- data/lib/leaflet/debug/vector/vector.html +37 -0
- data/lib/leaflet/debug/vector/vector2.html +58 -0
- data/lib/leaflet/dist/images/layers-2x.png +0 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/lib/leaflet/dist/images/marker-icon.png +0 -0
- data/lib/leaflet/dist/images/marker-shadow.png +0 -0
- data/lib/leaflet/dist/leaflet.css +494 -0
- data/lib/leaflet/package.json +28 -0
- data/lib/leaflet/spec/after.js +2 -0
- data/lib/leaflet/spec/expect.js +1253 -0
- data/lib/leaflet/spec/index.html +87 -0
- data/lib/leaflet/spec/karma.conf.js +68 -0
- data/lib/leaflet/spec/sinon.js +4223 -0
- data/lib/leaflet/spec/spec.hintrc.js +25 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +42 -0
- data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
- data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
- data/lib/leaflet/spec/suites/core/ClassSpec.js +166 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +416 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +237 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
- data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
- data/lib/leaflet/spec/suites/geo/CRSSpec.js +151 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +144 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +102 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +96 -0
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
- data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
- data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +86 -0
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +282 -0
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +71 -0
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +119 -0
- data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +117 -0
- data/lib/leaflet/spec/suites/layer/tile/GridLayerSpec.js +70 -0
- data/lib/leaflet/spec/suites/layer/tile/TileLayerSpec.js +88 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +18 -0
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +96 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
- data/lib/leaflet/spec/suites/map/MapSpec.js +553 -0
- data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/Leaflet.js +16 -11
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Attribution.js +1 -23
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Layers.js +42 -57
- data/lib/leaflet/src/control/Control.Scale.js +102 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Zoom.js +11 -18
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.js +7 -9
- data/lib/leaflet/src/copyright.js +4 -0
- data/lib/leaflet/src/core/Browser.js +65 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Class.js +8 -13
- data/lib/leaflet/src/core/Events.js +226 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Handler.js +0 -0
- data/lib/leaflet/src/core/Util.js +196 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.DoubleTap.js +20 -27
- data/lib/leaflet/src/dom/DomEvent.Pointer.js +107 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.js +70 -59
- data/lib/leaflet/src/dom/DomUtil.js +213 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/Draggable.js +10 -19
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.Timer.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.js +4 -3
- data/lib/leaflet/src/geo/LatLng.js +67 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/LatLngBounds.js +0 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.EPSG4326.js +2 -3
- data/lib/leaflet/src/geo/crs/CRS.Earth.js +19 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.Simple.js +10 -1
- data/lib/leaflet/src/geo/crs/CRS.js +63 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/projection/Projection.LonLat.js +5 -1
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +43 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +31 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Bounds.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/LineUtil.js +16 -5
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Point.js +10 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/PolyUtil.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Transformation.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/images/layers.svg +0 -0
- data/lib/leaflet/src/images/logo.svg +85 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/images/marker.svg +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/FeatureGroup.js +3 -20
- data/lib/leaflet/src/layer/GeoJSON.js +275 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +123 -0
- data/lib/leaflet/src/layer/Layer.Popup.js +87 -0
- data/lib/leaflet/src/layer/Layer.js +150 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/LayerGroup.js +12 -14
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/Popup.js +65 -83
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/DivIcon.js +3 -8
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.Default.js +6 -12
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.js +8 -25
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.Drag.js +13 -11
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +16 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.js +52 -103
- data/lib/leaflet/src/layer/tile/GridLayer.js +536 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +79 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +148 -0
- data/lib/leaflet/src/layer/vector/Canvas.js +292 -0
- data/lib/leaflet/src/layer/vector/Circle.js +67 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +72 -0
- data/lib/leaflet/src/layer/vector/Path.js +79 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +75 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +223 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/vector/Rectangle.js +27 -27
- data/lib/leaflet/src/layer/vector/Renderer.js +75 -0
- data/lib/leaflet/src/layer/vector/SVG.VML.js +134 -0
- data/lib/leaflet/src/layer/vector/SVG.js +189 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/Map.js +83 -199
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.ZoomAnimation.js +30 -38
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/ext/Map.Geolocation.js +8 -8
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +105 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Drag.js +12 -10
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Keyboard.js +19 -17
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.ScrollWheelZoom.js +10 -6
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Tap.js +8 -6
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.TouchZoom.js +16 -32
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/images/spritesheet-2x.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/{leaflet-js.js → javascripts/leaflet-js.js} +2 -2
- data/vendor/assets/javascripts/leaflet.draw.js +37 -0
- data/vendor/assets/javascripts/leaflet.js +149 -0
- data/vendor/assets/javascripts/leaflet.label.js +11 -0
- data/vendor/assets/{leaflet-js.css → stylesheets/leaflet-js.css} +0 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +478 -0
- data/vendor/assets/{leaflet.draw.css.erb → stylesheets/leaflet.draw.css.erb} +2 -2
- data/vendor/assets/{leaflet.draw.ie.css → stylesheets/leaflet.draw.ie.css} +0 -0
- data/vendor/assets/stylesheets/leaflet.label.css +52 -0
- metadata +298 -137
- data/lib/leaflet-js/engine.rb +0 -7
- data/lib/leaflet-js/version.rb +0 -3
- data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +0 -75
- data/vendor/assets/Leaflet/src/control/Control.Scale.js +0 -112
- data/vendor/assets/Leaflet/src/copyright.js +0 -5
- data/vendor/assets/Leaflet/src/core/Browser.js +0 -66
- data/vendor/assets/Leaflet/src/core/Events.js +0 -178
- data/vendor/assets/Leaflet/src/core/Util.js +0 -182
- data/vendor/assets/Leaflet/src/dom/DomEvent.Pointer.js +0 -156
- data/vendor/assets/Leaflet/src/dom/DomUtil.js +0 -289
- data/vendor/assets/Leaflet/src/geo/LatLng.js +0 -99
- data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3395.js +0 -14
- data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3857.js +0 -21
- data/vendor/assets/Leaflet/src/geo/crs/CRS.js +0 -32
- data/vendor/assets/Leaflet/src/geo/projection/Projection.Mercator.js +0 -56
- data/vendor/assets/Leaflet/src/geo/projection/Projection.SphericalMercator.js +0 -27
- data/vendor/assets/Leaflet/src/geo/projection/Projection.js +0 -5
- data/vendor/assets/Leaflet/src/layer/GeoJSON.js +0 -286
- data/vendor/assets/Leaflet/src/layer/ImageOverlay.js +0 -141
- data/vendor/assets/Leaflet/src/layer/marker/Marker.Popup.js +0 -90
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Anim.js +0 -110
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Canvas.js +0 -61
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.WMS.js +0 -87
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.js +0 -597
- data/vendor/assets/Leaflet/src/layer/vector/Circle.js +0 -98
- data/vendor/assets/Leaflet/src/layer/vector/CircleMarker.js +0 -45
- data/vendor/assets/Leaflet/src/layer/vector/MultiPoly.js +0 -57
- data/vendor/assets/Leaflet/src/layer/vector/Path.Popup.js +0 -65
- data/vendor/assets/Leaflet/src/layer/vector/Path.SVG.js +0 -230
- data/vendor/assets/Leaflet/src/layer/vector/Path.VML.js +0 -135
- data/vendor/assets/Leaflet/src/layer/vector/Path.js +0 -119
- data/vendor/assets/Leaflet/src/layer/vector/Polygon.js +0 -92
- data/vendor/assets/Leaflet/src/layer/vector/Polyline.js +0 -164
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Circle.Canvas.js +0 -18
- data/vendor/assets/Leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -9
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Path.Canvas.js +0 -204
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Polygon.Canvas.js +0 -37
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Polyline.Canvas.js +0 -30
- data/vendor/assets/Leaflet/src/map/handler/Map.BoxZoom.js +0 -118
- data/vendor/assets/leaflet.draw.js +0 -38
- data/vendor/assets/leaflet.js +0 -155
- data/vendor/assets/leaflet.label.js +0 -11
@@ -54,17 +54,15 @@ L.Control = L.Class.extend({
|
|
54
54
|
return this;
|
55
55
|
},
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
corner = map._controlCorners[pos];
|
60
|
-
|
61
|
-
corner.removeChild(this._container);
|
62
|
-
this._map = null;
|
57
|
+
remove: function () {
|
58
|
+
L.DomUtil.remove(this._container);
|
63
59
|
|
64
60
|
if (this.onRemove) {
|
65
|
-
this.onRemove(
|
61
|
+
this.onRemove(this._map);
|
66
62
|
}
|
67
63
|
|
64
|
+
this._map = null;
|
65
|
+
|
68
66
|
return this;
|
69
67
|
},
|
70
68
|
|
@@ -89,7 +87,7 @@ L.Map.include({
|
|
89
87
|
},
|
90
88
|
|
91
89
|
removeControl: function (control) {
|
92
|
-
control.
|
90
|
+
control.remove();
|
93
91
|
return this;
|
94
92
|
},
|
95
93
|
|
@@ -112,6 +110,6 @@ L.Map.include({
|
|
112
110
|
},
|
113
111
|
|
114
112
|
_clearControlPos: function () {
|
115
|
-
|
113
|
+
L.DomUtil.remove(this._controlContainer);
|
116
114
|
}
|
117
115
|
});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* L.Browser handles different browser and feature detections for internal Leaflet use.
|
3
|
+
*/
|
4
|
+
|
5
|
+
(function () {
|
6
|
+
|
7
|
+
var ua = navigator.userAgent.toLowerCase(),
|
8
|
+
doc = document.documentElement,
|
9
|
+
|
10
|
+
ie = 'ActiveXObject' in window,
|
11
|
+
|
12
|
+
webkit = ua.indexOf('webkit') !== -1,
|
13
|
+
phantomjs = ua.indexOf('phantom') !== -1,
|
14
|
+
android23 = ua.search('android [23]') !== -1,
|
15
|
+
chrome = ua.indexOf('chrome') !== -1,
|
16
|
+
|
17
|
+
mobile = typeof orientation !== 'undefined',
|
18
|
+
msPointer = navigator.msPointerEnabled && navigator.msMaxTouchPoints && !window.PointerEvent,
|
19
|
+
pointer = (window.PointerEvent && navigator.pointerEnabled && navigator.maxTouchPoints) || msPointer,
|
20
|
+
|
21
|
+
ie3d = ie && ('transition' in doc.style),
|
22
|
+
webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23,
|
23
|
+
gecko3d = 'MozPerspective' in doc.style,
|
24
|
+
opera3d = 'OTransition' in doc.style;
|
25
|
+
|
26
|
+
|
27
|
+
var retina = 'devicePixelRatio' in window && window.devicePixelRatio > 1;
|
28
|
+
|
29
|
+
if (!retina && 'matchMedia' in window) {
|
30
|
+
var matches = window.matchMedia('(min-resolution:144dpi)');
|
31
|
+
retina = matches && matches.matches;
|
32
|
+
}
|
33
|
+
|
34
|
+
var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
|
35
|
+
(window.DocumentTouch && document instanceof window.DocumentTouch));
|
36
|
+
|
37
|
+
L.Browser = {
|
38
|
+
ie: ie,
|
39
|
+
ielt9: ie && !document.addEventListener,
|
40
|
+
webkit: webkit,
|
41
|
+
gecko: (ua.indexOf('gecko') !== -1) && !webkit && !window.opera && !ie,
|
42
|
+
android: ua.indexOf('android') !== -1,
|
43
|
+
android23: android23,
|
44
|
+
chrome: chrome,
|
45
|
+
safari: !chrome && ua.indexOf('safari') !== -1,
|
46
|
+
|
47
|
+
ie3d: ie3d,
|
48
|
+
webkit3d: webkit3d,
|
49
|
+
gecko3d: gecko3d,
|
50
|
+
opera3d: opera3d,
|
51
|
+
any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs,
|
52
|
+
|
53
|
+
mobile: mobile,
|
54
|
+
mobileWebkit: mobile && webkit,
|
55
|
+
mobileWebkit3d: mobile && webkit3d,
|
56
|
+
mobileOpera: mobile && window.opera,
|
57
|
+
|
58
|
+
touch: !!touch,
|
59
|
+
msPointer: !!msPointer,
|
60
|
+
pointer: !!pointer,
|
61
|
+
|
62
|
+
retina: !!retina
|
63
|
+
};
|
64
|
+
|
65
|
+
}());
|
@@ -16,16 +16,15 @@ L.Class.extend = function (props) {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
// call all constructor hooks
|
19
|
-
if (this._initHooks) {
|
19
|
+
if (this._initHooks.length) {
|
20
20
|
this.callInitHooks();
|
21
21
|
}
|
22
22
|
};
|
23
23
|
|
24
|
-
//
|
25
|
-
var
|
26
|
-
F.prototype = this.prototype;
|
24
|
+
// jshint camelcase: false
|
25
|
+
var parentProto = NewClass.__super__ = this.prototype;
|
27
26
|
|
28
|
-
var proto =
|
27
|
+
var proto = L.Util.create(parentProto);
|
29
28
|
proto.constructor = NewClass;
|
30
29
|
|
31
30
|
NewClass.prototype = proto;
|
@@ -50,8 +49,8 @@ L.Class.extend = function (props) {
|
|
50
49
|
}
|
51
50
|
|
52
51
|
// merge options
|
53
|
-
if (
|
54
|
-
props.options = L.extend(
|
52
|
+
if (proto.options) {
|
53
|
+
props.options = L.Util.extend(L.Util.create(proto.options), props.options);
|
55
54
|
}
|
56
55
|
|
57
56
|
// mix given properties into the prototype
|
@@ -59,17 +58,13 @@ L.Class.extend = function (props) {
|
|
59
58
|
|
60
59
|
proto._initHooks = [];
|
61
60
|
|
62
|
-
var parent = this;
|
63
|
-
// jshint camelcase: false
|
64
|
-
NewClass.__super__ = parent.prototype;
|
65
|
-
|
66
61
|
// add method for calling all hooks
|
67
62
|
proto.callInitHooks = function () {
|
68
63
|
|
69
64
|
if (this._initHooksCalled) { return; }
|
70
65
|
|
71
|
-
if (
|
72
|
-
|
66
|
+
if (parentProto.callInitHooks) {
|
67
|
+
parentProto.callInitHooks.call(this);
|
73
68
|
}
|
74
69
|
|
75
70
|
this._initHooksCalled = true;
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/*
|
2
|
+
* L.Evented is a base class that Leaflet classes inherit from to handle custom events.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Evented = L.Class.extend({
|
6
|
+
|
7
|
+
on: function (types, fn, context) {
|
8
|
+
|
9
|
+
// types can be a map of types/handlers
|
10
|
+
if (typeof types === 'object') {
|
11
|
+
for (var type in types) {
|
12
|
+
// we don't process space-separated events here for performance;
|
13
|
+
// it's a hot path since Layer uses the on(obj) syntax
|
14
|
+
this._on(type, types[type], fn);
|
15
|
+
}
|
16
|
+
|
17
|
+
} else {
|
18
|
+
// types can be a string of space-separated words
|
19
|
+
types = L.Util.splitWords(types);
|
20
|
+
|
21
|
+
for (var i = 0, len = types.length; i < len; i++) {
|
22
|
+
this._on(types[i], fn, context);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return this;
|
27
|
+
},
|
28
|
+
|
29
|
+
off: function (types, fn, context) {
|
30
|
+
|
31
|
+
if (!types) {
|
32
|
+
// clear all listeners if called without arguments
|
33
|
+
delete this._events;
|
34
|
+
|
35
|
+
} else if (typeof types === 'object') {
|
36
|
+
for (var type in types) {
|
37
|
+
this._off(type, types[type], fn);
|
38
|
+
}
|
39
|
+
|
40
|
+
} else {
|
41
|
+
types = L.Util.splitWords(types);
|
42
|
+
|
43
|
+
for (var i = 0, len = types.length; i < len; i++) {
|
44
|
+
this._off(types[i], fn, context);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
return this;
|
49
|
+
},
|
50
|
+
|
51
|
+
// attach listener (without syntactic sugar now)
|
52
|
+
_on: function (type, fn, context) {
|
53
|
+
|
54
|
+
var events = this._events = this._events || {},
|
55
|
+
contextId = context && context !== this && L.stamp(context);
|
56
|
+
|
57
|
+
if (contextId) {
|
58
|
+
// store listeners with custom context in a separate hash (if it has an id);
|
59
|
+
// gives a major performance boost when firing and removing events (e.g. on map object)
|
60
|
+
|
61
|
+
var indexKey = type + '_idx',
|
62
|
+
indexLenKey = type + '_len',
|
63
|
+
typeIndex = events[indexKey] = events[indexKey] || {},
|
64
|
+
id = L.stamp(fn) + '_' + contextId;
|
65
|
+
|
66
|
+
if (!typeIndex[id]) {
|
67
|
+
typeIndex[id] = {fn: fn, ctx: context};
|
68
|
+
|
69
|
+
// keep track of the number of keys in the index to quickly check if it's empty
|
70
|
+
events[indexLenKey] = (events[indexLenKey] || 0) + 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
} else {
|
74
|
+
// individual layers mostly use "this" for context and don't fire listeners too often
|
75
|
+
// so simple array makes the memory footprint better while not degrading performance
|
76
|
+
|
77
|
+
events[type] = events[type] || [];
|
78
|
+
events[type].push({fn: fn});
|
79
|
+
}
|
80
|
+
},
|
81
|
+
|
82
|
+
_off: function (type, fn, context) {
|
83
|
+
var events = this._events,
|
84
|
+
indexKey = type + '_idx',
|
85
|
+
indexLenKey = type + '_len';
|
86
|
+
|
87
|
+
if (!events) { return; }
|
88
|
+
|
89
|
+
if (!fn) {
|
90
|
+
// clear all listeners for a type if function isn't specified
|
91
|
+
delete events[type];
|
92
|
+
delete events[indexKey];
|
93
|
+
delete events[indexLenKey];
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
|
97
|
+
var contextId = context && context !== this && L.stamp(context),
|
98
|
+
listeners, i, len, listener, id;
|
99
|
+
|
100
|
+
if (contextId) {
|
101
|
+
id = L.stamp(fn) + '_' + contextId;
|
102
|
+
listeners = events[indexKey];
|
103
|
+
|
104
|
+
if (listeners && listeners[id]) {
|
105
|
+
listener = listeners[id];
|
106
|
+
delete listeners[id];
|
107
|
+
events[indexLenKey]--;
|
108
|
+
}
|
109
|
+
|
110
|
+
} else {
|
111
|
+
listeners = events[type];
|
112
|
+
|
113
|
+
for (i = 0, len = listeners.length; i < len; i++) {
|
114
|
+
if (listeners[i].fn === fn) {
|
115
|
+
listener = listeners[i];
|
116
|
+
listeners.splice(i, 1);
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// set the removed listener to noop so that's not called if remove happens in fire
|
123
|
+
if (listener) {
|
124
|
+
listener.fn = L.Util.falseFn;
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
fire: function (type, data, propagate) {
|
129
|
+
if (!this.listens(type, propagate)) { return this; }
|
130
|
+
|
131
|
+
var event = L.Util.extend({}, data, {type: type, target: this}),
|
132
|
+
events = this._events;
|
133
|
+
|
134
|
+
if (events) {
|
135
|
+
var typeIndex = events[type + '_idx'],
|
136
|
+
i, len, listeners, id;
|
137
|
+
|
138
|
+
if (events[type]) {
|
139
|
+
// make sure adding/removing listeners inside other listeners won't cause infinite loop
|
140
|
+
listeners = events[type].slice();
|
141
|
+
|
142
|
+
for (i = 0, len = listeners.length; i < len; i++) {
|
143
|
+
listeners[i].fn.call(this, event);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
// fire event for the context-indexed listeners as well
|
148
|
+
for (id in typeIndex) {
|
149
|
+
typeIndex[id].fn.call(typeIndex[id].ctx, event);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
if (propagate) {
|
154
|
+
// propagate the event to parents (set with addEventParent)
|
155
|
+
this._propagateEvent(event);
|
156
|
+
}
|
157
|
+
|
158
|
+
return this;
|
159
|
+
},
|
160
|
+
|
161
|
+
listens: function (type, propagate) {
|
162
|
+
var events = this._events;
|
163
|
+
|
164
|
+
if (events && (events[type] || events[type + '_len'])) { return true; }
|
165
|
+
|
166
|
+
if (propagate) {
|
167
|
+
// also check parents for listeners if event propagates
|
168
|
+
for (var id in this._eventParents) {
|
169
|
+
if (this._eventParents[id].listens(type)) { return true; }
|
170
|
+
}
|
171
|
+
}
|
172
|
+
return false;
|
173
|
+
},
|
174
|
+
|
175
|
+
once: function (types, fn, context) {
|
176
|
+
|
177
|
+
if (typeof types === 'object') {
|
178
|
+
for (var type in types) {
|
179
|
+
this.once(type, types[type], fn);
|
180
|
+
}
|
181
|
+
return this;
|
182
|
+
}
|
183
|
+
|
184
|
+
var handler = L.bind(function () {
|
185
|
+
this
|
186
|
+
.off(types, fn, context)
|
187
|
+
.off(types, handler, context);
|
188
|
+
}, this);
|
189
|
+
|
190
|
+
// add a listener that's executed once and removed after that
|
191
|
+
return this
|
192
|
+
.on(types, fn, context)
|
193
|
+
.on(types, handler, context);
|
194
|
+
},
|
195
|
+
|
196
|
+
// adds a parent to propagate events to (when you fire with true as a 3rd argument)
|
197
|
+
addEventParent: function (obj) {
|
198
|
+
this._eventParents = this._eventParents || {};
|
199
|
+
this._eventParents[L.stamp(obj)] = obj;
|
200
|
+
return this;
|
201
|
+
},
|
202
|
+
|
203
|
+
removeEventParent: function (obj) {
|
204
|
+
if (this._eventParents) {
|
205
|
+
delete this._eventParents[L.stamp(obj)];
|
206
|
+
}
|
207
|
+
return this;
|
208
|
+
},
|
209
|
+
|
210
|
+
_propagateEvent: function (e) {
|
211
|
+
for (var id in this._eventParents) {
|
212
|
+
this._eventParents[id].fire(e.type, L.extend({layer: e.target}, e));
|
213
|
+
}
|
214
|
+
}
|
215
|
+
});
|
216
|
+
|
217
|
+
var proto = L.Evented.prototype;
|
218
|
+
|
219
|
+
// aliases; we should ditch those eventually
|
220
|
+
proto.addEventListener = proto.on;
|
221
|
+
proto.removeEventListener = proto.clearAllEventListeners = proto.off;
|
222
|
+
proto.addOneTimeEventListener = proto.once;
|
223
|
+
proto.fireEvent = proto.fire;
|
224
|
+
proto.hasEventListeners = proto.listens;
|
225
|
+
|
226
|
+
L.Mixin = {Events: proto};
|
File without changes
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/*
|
2
|
+
* L.Util contains various utility functions used throughout Leaflet code.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Util = {
|
6
|
+
// extend an object with properties of one or more other objects
|
7
|
+
extend: function (dest) {
|
8
|
+
var sources = Array.prototype.slice.call(arguments, 1),
|
9
|
+
i, j, len, src;
|
10
|
+
|
11
|
+
for (j = 0, len = sources.length; j < len; j++) {
|
12
|
+
src = sources[j];
|
13
|
+
for (i in src) {
|
14
|
+
dest[i] = src[i];
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return dest;
|
18
|
+
},
|
19
|
+
|
20
|
+
// create an object from a given prototype
|
21
|
+
create: Object.create || (function () {
|
22
|
+
function F() {}
|
23
|
+
return function (proto) {
|
24
|
+
F.prototype = proto;
|
25
|
+
return new F();
|
26
|
+
};
|
27
|
+
})(),
|
28
|
+
|
29
|
+
// bind a function to be called with a given context
|
30
|
+
bind: function (fn, obj) {
|
31
|
+
var slice = Array.prototype.slice;
|
32
|
+
|
33
|
+
if (fn.bind) {
|
34
|
+
return fn.bind.apply(fn, slice.call(arguments, 1));
|
35
|
+
}
|
36
|
+
|
37
|
+
var args = slice.call(arguments, 2);
|
38
|
+
|
39
|
+
return function () {
|
40
|
+
return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);
|
41
|
+
};
|
42
|
+
},
|
43
|
+
|
44
|
+
// return unique ID of an object
|
45
|
+
stamp: function (obj) {
|
46
|
+
// jshint camelcase: false
|
47
|
+
obj._leaflet_id = obj._leaflet_id || ++L.Util.lastId;
|
48
|
+
return obj._leaflet_id;
|
49
|
+
},
|
50
|
+
|
51
|
+
lastId: 0,
|
52
|
+
|
53
|
+
// return a function that won't be called more often than the given interval
|
54
|
+
throttle: function (fn, time, context) {
|
55
|
+
var lock, args, wrapperFn, later;
|
56
|
+
|
57
|
+
later = function () {
|
58
|
+
// reset lock and call if queued
|
59
|
+
lock = false;
|
60
|
+
if (args) {
|
61
|
+
wrapperFn.apply(context, args);
|
62
|
+
args = false;
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
wrapperFn = function () {
|
67
|
+
if (lock) {
|
68
|
+
// called too soon, queue to call later
|
69
|
+
args = arguments;
|
70
|
+
|
71
|
+
} else {
|
72
|
+
// call and lock until later
|
73
|
+
fn.apply(context, arguments);
|
74
|
+
setTimeout(later, time);
|
75
|
+
lock = true;
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
return wrapperFn;
|
80
|
+
},
|
81
|
+
|
82
|
+
// wrap the given number to lie within a certain range (used for wrapping longitude)
|
83
|
+
wrapNum: function (x, range, includeMax) {
|
84
|
+
var max = range[1],
|
85
|
+
min = range[0],
|
86
|
+
d = max - min;
|
87
|
+
return x === max && includeMax ? x : ((x - min) % d + d) % d + min;
|
88
|
+
},
|
89
|
+
|
90
|
+
// do nothing (used as a noop throughout the code)
|
91
|
+
falseFn: function () { return false; },
|
92
|
+
|
93
|
+
// round a given number to a given precision
|
94
|
+
formatNum: function (num, digits) {
|
95
|
+
var pow = Math.pow(10, digits || 5);
|
96
|
+
return Math.round(num * pow) / pow;
|
97
|
+
},
|
98
|
+
|
99
|
+
// trim whitespace from both sides of a string
|
100
|
+
trim: function (str) {
|
101
|
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
102
|
+
},
|
103
|
+
|
104
|
+
// split a string into words
|
105
|
+
splitWords: function (str) {
|
106
|
+
return L.Util.trim(str).split(/\s+/);
|
107
|
+
},
|
108
|
+
|
109
|
+
// set options to an object, inheriting parent's options as well
|
110
|
+
setOptions: function (obj, options) {
|
111
|
+
if (!obj.hasOwnProperty('options')) {
|
112
|
+
obj.options = obj.options ? L.Util.create(obj.options) : {};
|
113
|
+
}
|
114
|
+
for (var i in options) {
|
115
|
+
obj.options[i] = options[i];
|
116
|
+
}
|
117
|
+
return obj.options;
|
118
|
+
},
|
119
|
+
|
120
|
+
// make an URL with GET parameters out of a set of properties/values
|
121
|
+
getParamString: function (obj, existingUrl, uppercase) {
|
122
|
+
var params = [];
|
123
|
+
for (var i in obj) {
|
124
|
+
params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));
|
125
|
+
}
|
126
|
+
return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
|
127
|
+
},
|
128
|
+
|
129
|
+
// super-simple templating facility, used for TileLayer URLs
|
130
|
+
template: function (str, data) {
|
131
|
+
return str.replace(L.Util.templateRe, function (str, key) {
|
132
|
+
var value = data[key];
|
133
|
+
|
134
|
+
if (value === undefined) {
|
135
|
+
throw new Error('No value provided for variable ' + str);
|
136
|
+
|
137
|
+
} else if (typeof value === 'function') {
|
138
|
+
value = value(data);
|
139
|
+
}
|
140
|
+
return value;
|
141
|
+
});
|
142
|
+
},
|
143
|
+
|
144
|
+
templateRe: /\{ *([\w_]+) *\}/g,
|
145
|
+
|
146
|
+
isArray: Array.isArray || function (obj) {
|
147
|
+
return (Object.prototype.toString.call(obj) === '[object Array]');
|
148
|
+
},
|
149
|
+
|
150
|
+
// minimal image URI, set to an image when disposing to flush memory
|
151
|
+
emptyImageUrl: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
|
152
|
+
};
|
153
|
+
|
154
|
+
(function () {
|
155
|
+
// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
156
|
+
|
157
|
+
function getPrefixed(name) {
|
158
|
+
return window['webkit' + name] || window['moz' + name] || window['ms' + name];
|
159
|
+
}
|
160
|
+
|
161
|
+
var lastTime = 0;
|
162
|
+
|
163
|
+
// fallback for IE 7-8
|
164
|
+
function timeoutDefer(fn) {
|
165
|
+
var time = +new Date(),
|
166
|
+
timeToCall = Math.max(0, 16 - (time - lastTime));
|
167
|
+
|
168
|
+
lastTime = time + timeToCall;
|
169
|
+
return window.setTimeout(fn, timeToCall);
|
170
|
+
}
|
171
|
+
|
172
|
+
var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer,
|
173
|
+
cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||
|
174
|
+
getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };
|
175
|
+
|
176
|
+
|
177
|
+
L.Util.requestAnimFrame = function (fn, context, immediate, element) {
|
178
|
+
if (immediate && requestFn === timeoutDefer) {
|
179
|
+
fn.call(context);
|
180
|
+
} else {
|
181
|
+
return requestFn.call(window, L.bind(fn, context), element);
|
182
|
+
}
|
183
|
+
};
|
184
|
+
|
185
|
+
L.Util.cancelAnimFrame = function (id) {
|
186
|
+
if (id) {
|
187
|
+
cancelFn.call(window, id);
|
188
|
+
}
|
189
|
+
};
|
190
|
+
})();
|
191
|
+
|
192
|
+
// shortcuts for most used utility functions
|
193
|
+
L.extend = L.Util.extend;
|
194
|
+
L.bind = L.Util.bind;
|
195
|
+
L.stamp = L.Util.stamp;
|
196
|
+
L.setOptions = L.Util.setOptions;
|