leaflet-js 0.6.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.rdoc +32 -0
- data/LICENSE +21 -0
- data/README.rdoc +54 -0
- data/Rakefile +15 -0
- data/leaflet-js.gemspec +28 -0
- data/lib/leaflet-js.rb +10 -0
- data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
- data/lib/leaflet.draw/CHANGELOG.md +73 -0
- data/lib/leaflet.draw/Jakefile.js +26 -0
- data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.draw/README.md +364 -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 +189 -0
- data/lib/leaflet.draw/build/deps.js +75 -0
- data/lib/leaflet.draw/build/hintrc.js +47 -0
- data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
- data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +2429 -0
- data/lib/leaflet.draw/dist/leaflet.draw.css +212 -0
- data/lib/leaflet.draw/dist/leaflet.draw.ie.css +44 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
- data/lib/leaflet.draw/examples/basic.html +106 -0
- data/lib/leaflet.draw/examples/edithandlers.html +67 -0
- data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
- data/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/lib/leaflet.draw/examples/libs/images/marker-shadow.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +8587 -0
- data/lib/leaflet.draw/examples/libs/leaflet.css +459 -0
- data/lib/leaflet.draw/examples/libs/leaflet.ie.css +51 -0
- data/lib/leaflet.draw/package.json +37 -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 +36 -0
- data/lib/leaflet.draw/spec/karma.conf.js +69 -0
- data/lib/leaflet.draw/spec/sinon.js +4223 -0
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +15 -0
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +26 -0
- data/lib/leaflet.draw/src/Control.Draw.js +101 -0
- data/lib/leaflet.draw/src/Leaflet.draw.js +5 -0
- data/lib/leaflet.draw/src/Toolbar.js +187 -0
- data/lib/leaflet.draw/src/Tooltip.js +52 -0
- data/lib/leaflet.draw/src/copyright.js +8 -0
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +107 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +59 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +74 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +97 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +79 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +360 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +41 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +67 -0
- data/lib/leaflet.draw/src/edit/EditToolbar.js +93 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Circle.js +63 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +267 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Rectangle.js +117 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +138 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +109 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +233 -0
- data/lib/leaflet.draw/src/ext/LatLngUtil.js +18 -0
- data/lib/leaflet.draw/src/ext/LineUtil.Intersect.js +15 -0
- data/lib/leaflet.draw/src/ext/Polygon.Intersect.js +27 -0
- data/lib/leaflet.draw/src/ext/Polyline.Intersect.js +85 -0
- data/lib/leaflet.label/CHANGELOG.md +35 -0
- data/lib/leaflet.label/Jakefile.js +21 -0
- data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.label/README.md +86 -0
- data/lib/leaflet.label/build/build.js +155 -0
- data/lib/leaflet.label/build/deps.js +24 -0
- data/lib/leaflet.label/build/hint.js +30 -0
- data/lib/leaflet.label/build/hintrc.js +47 -0
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +359 -0
- data/lib/leaflet.label/dist/leaflet.label.css +33 -0
- data/lib/leaflet.label/dist/leaflet.label.js +9 -0
- data/lib/leaflet.label/example/label.html +82 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.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 +8587 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.css +459 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +51 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.js +8 -0
- data/lib/leaflet.label/src/FeatureGroup.Label.js +20 -0
- data/lib/leaflet.label/src/Label.js +123 -0
- data/lib/leaflet.label/src/Leaflet.label.js +5 -0
- data/lib/leaflet.label/src/Map.Label.js +7 -0
- data/lib/leaflet.label/src/Marker.Label.js +160 -0
- data/lib/leaflet.label/src/Path.Label.js +55 -0
- data/lib/leaflet.label/src/copyright.js +8 -0
- data/lib/leaflet/CHANGELOG.md +637 -0
- data/lib/leaflet/CONTRIBUTING.md +155 -0
- data/lib/leaflet/Jakefile.js +26 -0
- data/lib/leaflet/LICENSE +23 -0
- data/lib/leaflet/README.md +30 -0
- data/lib/leaflet/build/build.html +243 -0
- data/lib/leaflet/build/build.js +193 -0
- data/lib/leaflet/build/deps.js +256 -0
- data/lib/leaflet/build/hintrc.js +37 -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 +43 -0
- data/lib/leaflet/debug/leaflet-include.js +59 -0
- data/lib/leaflet/debug/map/canvas.html +47 -0
- data/lib/leaflet/debug/map/controls.html +50 -0
- data/lib/leaflet/debug/map/geolocation.html +35 -0
- data/lib/leaflet/debug/map/image-overlay.html +44 -0
- data/lib/leaflet/debug/map/map-mobile.html +35 -0
- data/lib/leaflet/debug/map/map.html +60 -0
- data/lib/leaflet/debug/map/max-bounds.html +37 -0
- data/lib/leaflet/debug/map/scroll.html +36 -0
- data/lib/leaflet/debug/map/simple-proj.html +45 -0
- data/lib/leaflet/debug/map/wms-marble.html +31 -0
- data/lib/leaflet/debug/map/wms.html +41 -0
- data/lib/leaflet/debug/map/zoomlevels.html +46 -0
- data/lib/leaflet/debug/tests/add_remove_layers.html +88 -0
- data/lib/leaflet/debug/tests/bringtoback.html +38 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +59 -0
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
- data/lib/leaflet/debug/tests/opacity.html +57 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +29 -0
- data/lib/leaflet/debug/tests/removetilewhilepan.html +42 -0
- data/lib/leaflet/debug/tests/reuse_popups.html +41 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +55 -0
- data/lib/leaflet/debug/vector/bounds-extend.html +89 -0
- data/lib/leaflet/debug/vector/feature-group-bounds.html +91 -0
- data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
- data/lib/leaflet/debug/vector/geojson.html +174 -0
- data/lib/leaflet/debug/vector/rectangle.html +54 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/touchzoomemu.html +195 -0
- data/lib/leaflet/debug/vector/us-states.js +54 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +70 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +93 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +39 -0
- data/lib/leaflet/debug/vector/vector-simple.html +49 -0
- data/lib/leaflet/debug/vector/vector.html +38 -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-src.js +8579 -0
- data/lib/leaflet/dist/leaflet.css +459 -0
- data/lib/leaflet/dist/leaflet.ie.css +51 -0
- data/lib/leaflet/dist/leaflet.js +8 -0
- data/lib/leaflet/package.json +22 -0
- data/lib/leaflet/spec/after.js +2 -0
- data/lib/leaflet/spec/before.js +3 -0
- data/lib/leaflet/spec/expect.js +1253 -0
- data/lib/leaflet/spec/happen.js +93 -0
- data/lib/leaflet/spec/index.html +78 -0
- data/lib/leaflet/spec/karma.conf.js +64 -0
- data/lib/leaflet/spec/sinon.js +4223 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +13 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +26 -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 +156 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +336 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +212 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +89 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +136 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +118 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +47 -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 +36 -0
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +86 -0
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +58 -0
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +59 -0
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +87 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +17 -0
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +55 -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 +244 -0
- data/lib/leaflet/src/Leaflet.js +23 -0
- data/lib/leaflet/src/control/Control.Attribution.js +115 -0
- data/lib/leaflet/src/control/Control.Layers.js +243 -0
- data/lib/leaflet/src/control/Control.Scale.js +112 -0
- data/lib/leaflet/src/control/Control.Zoom.js +86 -0
- data/lib/leaflet/src/control/Control.js +107 -0
- data/lib/leaflet/src/copyright.js +4 -0
- data/lib/leaflet/src/core/Browser.js +96 -0
- data/lib/leaflet/src/core/Class.js +106 -0
- data/lib/leaflet/src/core/Events.js +174 -0
- data/lib/leaflet/src/core/Handler.js +28 -0
- data/lib/leaflet/src/core/Util.js +182 -0
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +103 -0
- data/lib/leaflet/src/dom/DomEvent.MsTouch.js +146 -0
- data/lib/leaflet/src/dom/DomEvent.js +211 -0
- data/lib/leaflet/src/dom/DomUtil.js +239 -0
- data/lib/leaflet/src/dom/Draggable.js +198 -0
- data/lib/leaflet/src/dom/PosAnimation.Timer.js +67 -0
- data/lib/leaflet/src/dom/PosAnimation.js +83 -0
- data/lib/leaflet/src/geo/LatLng.js +88 -0
- data/lib/leaflet/src/geo/LatLngBounds.js +153 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +14 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +21 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +10 -0
- data/lib/leaflet/src/geo/crs/CRS.Simple.js +12 -0
- data/lib/leaflet/src/geo/crs/CRS.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.LonLat.js +13 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +56 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.js +5 -0
- data/lib/leaflet/src/geometry/Bounds.js +95 -0
- data/lib/leaflet/src/geometry/LineUtil.js +202 -0
- data/lib/leaflet/src/geometry/Point.js +119 -0
- data/lib/leaflet/src/geometry/PolyUtil.js +55 -0
- data/lib/leaflet/src/geometry/Transformation.js +31 -0
- data/lib/leaflet/src/images/marker.svg +1 -0
- data/lib/leaflet/src/layer/FeatureGroup.js +81 -0
- data/lib/leaflet/src/layer/GeoJSON.js +245 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +132 -0
- data/lib/leaflet/src/layer/LayerGroup.js +110 -0
- data/lib/leaflet/src/layer/Popup.js +316 -0
- data/lib/leaflet/src/layer/marker/DivIcon.js +43 -0
- data/lib/leaflet/src/layer/marker/Icon.Default.js +51 -0
- data/lib/leaflet/src/layer/marker/Icon.js +101 -0
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +66 -0
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +72 -0
- data/lib/leaflet/src/layer/marker/Marker.js +275 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +117 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +60 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +83 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +578 -0
- data/lib/leaflet/src/layer/vector/Circle.js +98 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +33 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +47 -0
- data/lib/leaflet/src/layer/vector/Path.Popup.js +65 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +219 -0
- data/lib/leaflet/src/layer/vector/Path.VML.js +125 -0
- data/lib/leaflet/src/layer/vector/Path.js +115 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +81 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +164 -0
- data/lib/leaflet/src/layer/vector/Rectangle.js +27 -0
- data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +196 -0
- data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +37 -0
- data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +30 -0
- data/lib/leaflet/src/map/Map.js +743 -0
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +88 -0
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +90 -0
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +91 -0
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +104 -0
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +23 -0
- data/lib/leaflet/src/map/handler/Map.Drag.js +146 -0
- data/lib/leaflet/src/map/handler/Map.Keyboard.js +147 -0
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +56 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +121 -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.png +0 -0
- data/vendor/assets/javascripts/leaflet.draw.js +39 -0
- data/vendor/assets/javascripts/leaflet.js +145 -0
- data/vendor/assets/javascripts/leaflet.label.js +9 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +459 -0
- data/vendor/assets/stylesheets/leaflet.draw.css.erb +212 -0
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +44 -0
- data/vendor/assets/stylesheets/leaflet.ie.css +51 -0
- data/vendor/assets/stylesheets/leaflet.label.css +33 -0
- metadata +317 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
/*
|
2
|
+
* L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.mergeOptions({
|
6
|
+
keyboard: true,
|
7
|
+
keyboardPanOffset: 80,
|
8
|
+
keyboardZoomOffset: 1
|
9
|
+
});
|
10
|
+
|
11
|
+
L.Map.Keyboard = L.Handler.extend({
|
12
|
+
|
13
|
+
keyCodes: {
|
14
|
+
left: [37],
|
15
|
+
right: [39],
|
16
|
+
down: [40],
|
17
|
+
up: [38],
|
18
|
+
zoomIn: [187, 107, 61],
|
19
|
+
zoomOut: [189, 109, 173]
|
20
|
+
},
|
21
|
+
|
22
|
+
initialize: function (map) {
|
23
|
+
this._map = map;
|
24
|
+
|
25
|
+
this._setPanOffset(map.options.keyboardPanOffset);
|
26
|
+
this._setZoomOffset(map.options.keyboardZoomOffset);
|
27
|
+
},
|
28
|
+
|
29
|
+
addHooks: function () {
|
30
|
+
var container = this._map._container;
|
31
|
+
|
32
|
+
// make the container focusable by tabbing
|
33
|
+
if (container.tabIndex === -1) {
|
34
|
+
container.tabIndex = '0';
|
35
|
+
}
|
36
|
+
|
37
|
+
L.DomEvent
|
38
|
+
.on(container, 'focus', this._onFocus, this)
|
39
|
+
.on(container, 'blur', this._onBlur, this)
|
40
|
+
.on(container, 'mousedown', this._onMouseDown, this);
|
41
|
+
|
42
|
+
this._map
|
43
|
+
.on('focus', this._addHooks, this)
|
44
|
+
.on('blur', this._removeHooks, this);
|
45
|
+
},
|
46
|
+
|
47
|
+
removeHooks: function () {
|
48
|
+
this._removeHooks();
|
49
|
+
|
50
|
+
var container = this._map._container;
|
51
|
+
|
52
|
+
L.DomEvent
|
53
|
+
.off(container, 'focus', this._onFocus, this)
|
54
|
+
.off(container, 'blur', this._onBlur, this)
|
55
|
+
.off(container, 'mousedown', this._onMouseDown, this);
|
56
|
+
|
57
|
+
this._map
|
58
|
+
.off('focus', this._addHooks, this)
|
59
|
+
.off('blur', this._removeHooks, this);
|
60
|
+
},
|
61
|
+
|
62
|
+
_onMouseDown: function () {
|
63
|
+
if (this._focused) { return; }
|
64
|
+
|
65
|
+
var body = document.body,
|
66
|
+
docEl = document.documentElement,
|
67
|
+
top = body.scrollTop || docEl.scrollTop,
|
68
|
+
left = body.scrollTop || docEl.scrollLeft;
|
69
|
+
|
70
|
+
this._map._container.focus();
|
71
|
+
|
72
|
+
window.scrollTo(left, top);
|
73
|
+
},
|
74
|
+
|
75
|
+
_onFocus: function () {
|
76
|
+
this._focused = true;
|
77
|
+
this._map.fire('focus');
|
78
|
+
},
|
79
|
+
|
80
|
+
_onBlur: function () {
|
81
|
+
this._focused = false;
|
82
|
+
this._map.fire('blur');
|
83
|
+
},
|
84
|
+
|
85
|
+
_setPanOffset: function (pan) {
|
86
|
+
var keys = this._panKeys = {},
|
87
|
+
codes = this.keyCodes,
|
88
|
+
i, len;
|
89
|
+
|
90
|
+
for (i = 0, len = codes.left.length; i < len; i++) {
|
91
|
+
keys[codes.left[i]] = [-1 * pan, 0];
|
92
|
+
}
|
93
|
+
for (i = 0, len = codes.right.length; i < len; i++) {
|
94
|
+
keys[codes.right[i]] = [pan, 0];
|
95
|
+
}
|
96
|
+
for (i = 0, len = codes.down.length; i < len; i++) {
|
97
|
+
keys[codes.down[i]] = [0, pan];
|
98
|
+
}
|
99
|
+
for (i = 0, len = codes.up.length; i < len; i++) {
|
100
|
+
keys[codes.up[i]] = [0, -1 * pan];
|
101
|
+
}
|
102
|
+
},
|
103
|
+
|
104
|
+
_setZoomOffset: function (zoom) {
|
105
|
+
var keys = this._zoomKeys = {},
|
106
|
+
codes = this.keyCodes,
|
107
|
+
i, len;
|
108
|
+
|
109
|
+
for (i = 0, len = codes.zoomIn.length; i < len; i++) {
|
110
|
+
keys[codes.zoomIn[i]] = zoom;
|
111
|
+
}
|
112
|
+
for (i = 0, len = codes.zoomOut.length; i < len; i++) {
|
113
|
+
keys[codes.zoomOut[i]] = -zoom;
|
114
|
+
}
|
115
|
+
},
|
116
|
+
|
117
|
+
_addHooks: function () {
|
118
|
+
L.DomEvent.on(document, 'keydown', this._onKeyDown, this);
|
119
|
+
},
|
120
|
+
|
121
|
+
_removeHooks: function () {
|
122
|
+
L.DomEvent.off(document, 'keydown', this._onKeyDown, this);
|
123
|
+
},
|
124
|
+
|
125
|
+
_onKeyDown: function (e) {
|
126
|
+
var key = e.keyCode,
|
127
|
+
map = this._map;
|
128
|
+
|
129
|
+
if (key in this._panKeys) {
|
130
|
+
map.panBy(this._panKeys[key]);
|
131
|
+
|
132
|
+
if (map.options.maxBounds) {
|
133
|
+
map.panInsideBounds(map.options.maxBounds);
|
134
|
+
}
|
135
|
+
|
136
|
+
} else if (key in this._zoomKeys) {
|
137
|
+
map.setZoom(map.getZoom() + this._zoomKeys[key]);
|
138
|
+
|
139
|
+
} else {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
L.DomEvent.stop(e);
|
144
|
+
}
|
145
|
+
});
|
146
|
+
|
147
|
+
L.Map.addInitHook('addHandler', 'keyboard', L.Map.Keyboard);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
* L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.mergeOptions({
|
6
|
+
scrollWheelZoom: true
|
7
|
+
});
|
8
|
+
|
9
|
+
L.Map.ScrollWheelZoom = L.Handler.extend({
|
10
|
+
addHooks: function () {
|
11
|
+
L.DomEvent.on(this._map._container, 'mousewheel', this._onWheelScroll, this);
|
12
|
+
this._delta = 0;
|
13
|
+
},
|
14
|
+
|
15
|
+
removeHooks: function () {
|
16
|
+
L.DomEvent.off(this._map._container, 'mousewheel', this._onWheelScroll);
|
17
|
+
},
|
18
|
+
|
19
|
+
_onWheelScroll: function (e) {
|
20
|
+
var delta = L.DomEvent.getWheelDelta(e);
|
21
|
+
|
22
|
+
this._delta += delta;
|
23
|
+
this._lastMousePos = this._map.mouseEventToContainerPoint(e);
|
24
|
+
|
25
|
+
if (!this._startTime) {
|
26
|
+
this._startTime = +new Date();
|
27
|
+
}
|
28
|
+
|
29
|
+
var left = Math.max(40 - (+new Date() - this._startTime), 0);
|
30
|
+
|
31
|
+
clearTimeout(this._timer);
|
32
|
+
this._timer = setTimeout(L.bind(this._performZoom, this), left);
|
33
|
+
|
34
|
+
L.DomEvent.preventDefault(e);
|
35
|
+
L.DomEvent.stopPropagation(e);
|
36
|
+
},
|
37
|
+
|
38
|
+
_performZoom: function () {
|
39
|
+
var map = this._map,
|
40
|
+
delta = this._delta,
|
41
|
+
zoom = map.getZoom();
|
42
|
+
|
43
|
+
delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
|
44
|
+
delta = Math.max(Math.min(delta, 4), -4);
|
45
|
+
delta = map._limitZoom(zoom + delta) - zoom;
|
46
|
+
|
47
|
+
this._delta = 0;
|
48
|
+
this._startTime = null;
|
49
|
+
|
50
|
+
if (!delta) { return; }
|
51
|
+
|
52
|
+
map.setZoomAround(this._lastMousePos, zoom + delta);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
L.Map.addInitHook('addHandler', 'scrollWheelZoom', L.Map.ScrollWheelZoom);
|
@@ -0,0 +1,121 @@
|
|
1
|
+
/*
|
2
|
+
* L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.mergeOptions({
|
6
|
+
touchZoom: L.Browser.touch && !L.Browser.android23
|
7
|
+
});
|
8
|
+
|
9
|
+
L.Map.TouchZoom = L.Handler.extend({
|
10
|
+
addHooks: function () {
|
11
|
+
L.DomEvent.on(this._map._container, 'touchstart', this._onTouchStart, this);
|
12
|
+
},
|
13
|
+
|
14
|
+
removeHooks: function () {
|
15
|
+
L.DomEvent.off(this._map._container, 'touchstart', this._onTouchStart, this);
|
16
|
+
},
|
17
|
+
|
18
|
+
_onTouchStart: function (e) {
|
19
|
+
var map = this._map;
|
20
|
+
|
21
|
+
if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
|
22
|
+
|
23
|
+
var p1 = map.mouseEventToLayerPoint(e.touches[0]),
|
24
|
+
p2 = map.mouseEventToLayerPoint(e.touches[1]),
|
25
|
+
viewCenter = map._getCenterLayerPoint();
|
26
|
+
|
27
|
+
this._startCenter = p1.add(p2)._divideBy(2);
|
28
|
+
this._startDist = p1.distanceTo(p2);
|
29
|
+
|
30
|
+
this._moved = false;
|
31
|
+
this._zooming = true;
|
32
|
+
|
33
|
+
this._centerOffset = viewCenter.subtract(this._startCenter);
|
34
|
+
|
35
|
+
if (map._panAnim) {
|
36
|
+
map._panAnim.stop();
|
37
|
+
}
|
38
|
+
|
39
|
+
L.DomEvent
|
40
|
+
.on(document, 'touchmove', this._onTouchMove, this)
|
41
|
+
.on(document, 'touchend', this._onTouchEnd, this);
|
42
|
+
|
43
|
+
L.DomEvent.preventDefault(e);
|
44
|
+
},
|
45
|
+
|
46
|
+
_onTouchMove: function (e) {
|
47
|
+
var map = this._map;
|
48
|
+
|
49
|
+
if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
|
50
|
+
|
51
|
+
var p1 = map.mouseEventToLayerPoint(e.touches[0]),
|
52
|
+
p2 = map.mouseEventToLayerPoint(e.touches[1]);
|
53
|
+
|
54
|
+
this._scale = p1.distanceTo(p2) / this._startDist;
|
55
|
+
this._delta = p1._add(p2)._divideBy(2)._subtract(this._startCenter);
|
56
|
+
|
57
|
+
if (this._scale === 1) { return; }
|
58
|
+
|
59
|
+
if (!this._moved) {
|
60
|
+
L.DomUtil.addClass(map._mapPane, 'leaflet-touching');
|
61
|
+
|
62
|
+
map
|
63
|
+
.fire('movestart')
|
64
|
+
.fire('zoomstart');
|
65
|
+
|
66
|
+
this._moved = true;
|
67
|
+
}
|
68
|
+
|
69
|
+
L.Util.cancelAnimFrame(this._animRequest);
|
70
|
+
this._animRequest = L.Util.requestAnimFrame(
|
71
|
+
this._updateOnMove, this, true, this._map._container);
|
72
|
+
|
73
|
+
L.DomEvent.preventDefault(e);
|
74
|
+
},
|
75
|
+
|
76
|
+
_updateOnMove: function () {
|
77
|
+
var map = this._map,
|
78
|
+
origin = this._getScaleOrigin(),
|
79
|
+
center = map.layerPointToLatLng(origin),
|
80
|
+
zoom = map.getScaleZoom(this._scale);
|
81
|
+
|
82
|
+
map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta, true);
|
83
|
+
},
|
84
|
+
|
85
|
+
_onTouchEnd: function () {
|
86
|
+
if (!this._moved || !this._zooming) {
|
87
|
+
this._zooming = false;
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
|
91
|
+
var map = this._map;
|
92
|
+
|
93
|
+
this._zooming = false;
|
94
|
+
L.DomUtil.removeClass(map._mapPane, 'leaflet-touching');
|
95
|
+
L.Util.cancelAnimFrame(this._animRequest);
|
96
|
+
|
97
|
+
L.DomEvent
|
98
|
+
.off(document, 'touchmove', this._onTouchMove)
|
99
|
+
.off(document, 'touchend', this._onTouchEnd);
|
100
|
+
|
101
|
+
var origin = this._getScaleOrigin(),
|
102
|
+
center = map.layerPointToLatLng(origin),
|
103
|
+
|
104
|
+
oldZoom = map.getZoom(),
|
105
|
+
floatZoomDelta = map.getScaleZoom(this._scale) - oldZoom,
|
106
|
+
roundZoomDelta = (floatZoomDelta > 0 ?
|
107
|
+
Math.ceil(floatZoomDelta) : Math.floor(floatZoomDelta)),
|
108
|
+
|
109
|
+
zoom = map._limitZoom(oldZoom + roundZoomDelta),
|
110
|
+
scale = map.getZoomScale(zoom) / this._scale;
|
111
|
+
|
112
|
+
map._animateZoom(center, zoom, origin, scale, null, true);
|
113
|
+
},
|
114
|
+
|
115
|
+
_getScaleOrigin: function () {
|
116
|
+
var centerOffset = this._centerOffset.subtract(this._delta).divideBy(this._scale);
|
117
|
+
return this._startCenter.add(centerOffset);
|
118
|
+
}
|
119
|
+
});
|
120
|
+
|
121
|
+
L.Map.addInitHook('addHandler', 'touchZoom', L.Map.TouchZoom);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Core
|
2
|
+
//=require ../../../lib/leaflet.draw/src/Leaflet.draw.js
|
3
|
+
|
4
|
+
// DrawHandlers
|
5
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Feature.js
|
6
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Polyline.js
|
7
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Polygon.js
|
8
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js
|
9
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js
|
10
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Circle.js
|
11
|
+
//=require ../../../lib/leaflet.draw/src/draw/handler/Draw.Marker.js
|
12
|
+
|
13
|
+
// EditHandlers
|
14
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/Edit.Poly.js
|
15
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js
|
16
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/Edit.Rectangle.js
|
17
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/Edit.Circle.js
|
18
|
+
|
19
|
+
// Extensions
|
20
|
+
//=require ../../../lib/leaflet.draw/src/ext/LatLngUtil.js
|
21
|
+
//=require ../../../lib/leaflet.draw/src/ext/LineUtil.Intersect.js
|
22
|
+
//=require ../../../lib/leaflet.draw/src/ext/Polyline.Intersect.js
|
23
|
+
//=require ../../../lib/leaflet.draw/src/ext/Polygon.Intersect.js
|
24
|
+
|
25
|
+
// CommonUI
|
26
|
+
//=require ../../../lib/leaflet.draw/src/Control.Draw.js
|
27
|
+
//=require ../../../lib/leaflet.draw/src/Toolbar.js
|
28
|
+
//=require ../../../lib/leaflet.draw/src/Tooltip.js
|
29
|
+
|
30
|
+
// CommonUI
|
31
|
+
//=require ../../../lib/leaflet.draw/src/draw/DrawToolbar.js
|
32
|
+
|
33
|
+
// CommonUI
|
34
|
+
//=require ../../../lib/leaflet.draw/src/draw/DrawToolbar.js
|
35
|
+
|
36
|
+
// EditUI
|
37
|
+
//=require ../../../lib/leaflet.draw/src/edit/EditToolbar.js
|
38
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js
|
39
|
+
//=require ../../../lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js
|
@@ -0,0 +1,145 @@
|
|
1
|
+
// The core of the library, including OOP, events, DOM facilities, basic units,
|
2
|
+
// projections (EPSG:3857 and EPSG:4326) and the base Map class.
|
3
|
+
//=require ../../../lib/leaflet/src/Leaflet.js
|
4
|
+
//=require ../../../lib/leaflet/src/core/Util.js
|
5
|
+
//=require ../../../lib/leaflet/src/core/Class.js
|
6
|
+
//=require ../../../lib/leaflet/src/core/Events.js
|
7
|
+
//=require ../../../lib/leaflet/src/core/Browser.js
|
8
|
+
//=require ../../../lib/leaflet/src/geometry/Point.js
|
9
|
+
//=require ../../../lib/leaflet/src/geometry/Bounds.js
|
10
|
+
//=require ../../../lib/leaflet/src/geometry/Transformation.js
|
11
|
+
//=require ../../../lib/leaflet/src/dom/DomUtil.js
|
12
|
+
//=require ../../../lib/leaflet/src/geo/LatLng.js
|
13
|
+
//=require ../../../lib/leaflet/src/geo/LatLngBounds.js
|
14
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.js
|
15
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.SphericalMercator.js
|
16
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.LonLat.js
|
17
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.js
|
18
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.Simple.js
|
19
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG3857.js
|
20
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG4326.js
|
21
|
+
//=require ../../../lib/leaflet/src/map/Map.js
|
22
|
+
|
23
|
+
// EPSG3395
|
24
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.Mercator.js
|
25
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG3395.js
|
26
|
+
|
27
|
+
// TileLayer
|
28
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.js
|
29
|
+
|
30
|
+
// TileLayerWMS
|
31
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.WMS.js
|
32
|
+
|
33
|
+
// TileLayerCanvas
|
34
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.Canvas.js
|
35
|
+
|
36
|
+
// ImageOverlay
|
37
|
+
//=require ../../../lib/leaflet/src/layer/ImageOverlay.js
|
38
|
+
|
39
|
+
// Marker
|
40
|
+
//=require ../../../lib/leaflet/src/layer/marker/Icon.js
|
41
|
+
//=require ../../../lib/leaflet/src/layer/marker/Icon.Default.js
|
42
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.js
|
43
|
+
|
44
|
+
// DivIcon
|
45
|
+
//=require ../../../lib/leaflet/src/layer/marker/DivIcon.js
|
46
|
+
|
47
|
+
// Popup
|
48
|
+
//=require ../../../lib/leaflet/src/layer/Popup.js
|
49
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.Popup.js
|
50
|
+
|
51
|
+
// LayerGroup:
|
52
|
+
//=require ../../../lib/leaflet/src/layer/LayerGroup.js
|
53
|
+
|
54
|
+
// FeatureGroup
|
55
|
+
//=require ../../../lib/leaflet/src/layer/FeatureGroup.js
|
56
|
+
|
57
|
+
// Path
|
58
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.js
|
59
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.SVG.js
|
60
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.Popup.js
|
61
|
+
|
62
|
+
// PathVML
|
63
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.VML.js
|
64
|
+
|
65
|
+
// PathCanvas
|
66
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Path.Canvas.js
|
67
|
+
|
68
|
+
// Polyline
|
69
|
+
//=require ../../../lib/leaflet/src/geometry/LineUtil.js
|
70
|
+
//=require ../../../lib/leaflet/src/layer/vector/Polyline.js
|
71
|
+
|
72
|
+
// Polygon
|
73
|
+
//=require ../../../lib/leaflet/src/geometry/PolyUtil.js
|
74
|
+
//=require ../../../lib/leaflet/src/layer/vector/Polygon.js
|
75
|
+
|
76
|
+
// MultiPoly
|
77
|
+
//=require ../../../lib/leaflet/src/layer/vector/MultiPoly.js
|
78
|
+
|
79
|
+
// Rectangle
|
80
|
+
//=require ../../../lib/leaflet/src/layer/vector/Rectangle.js
|
81
|
+
|
82
|
+
// Circle
|
83
|
+
//=require ../../../lib/leaflet/src/layer/vector/Circle.js
|
84
|
+
|
85
|
+
// CircleMarker
|
86
|
+
//=require ../../../lib/leaflet/src/layer/vector/CircleMarker.js
|
87
|
+
|
88
|
+
// VectorsCanvas
|
89
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js
|
90
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js
|
91
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js
|
92
|
+
|
93
|
+
// GeoJSON
|
94
|
+
//=require ../../../lib/leaflet/src/layer/GeoJSON.js
|
95
|
+
|
96
|
+
// MapDrag
|
97
|
+
//=require ../../../lib/leaflet/src/dom/DomEvent.js
|
98
|
+
//=require ../../../lib/leaflet/src/dom/Draggable.js
|
99
|
+
//=require ../../../lib/leaflet/src/core/Handler.js
|
100
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.Drag.js
|
101
|
+
|
102
|
+
// MouseZoom
|
103
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
|
104
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js
|
105
|
+
|
106
|
+
// TouchZoom
|
107
|
+
//=require ../../../lib/leaflet/src/dom/DomEvent.DoubleTap.js
|
108
|
+
//=require ../../../lib/leaflet/src/dom/DomEvent.MsTouch.js
|
109
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.TouchZoom.js
|
110
|
+
|
111
|
+
// BoxZoom
|
112
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.BoxZoom.js
|
113
|
+
|
114
|
+
// Keyboard
|
115
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.Keyboard.js
|
116
|
+
|
117
|
+
// MarkerDrag
|
118
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.Drag.js
|
119
|
+
|
120
|
+
// ControlZoom
|
121
|
+
//=require ../../../lib/leaflet/src/control/Control.js
|
122
|
+
//=require ../../../lib/leaflet/src/control/Control.Zoom.js
|
123
|
+
|
124
|
+
// ControlAttrib
|
125
|
+
//=require ../../../lib/leaflet/src/control/Control.Attribution.js
|
126
|
+
|
127
|
+
// ControlScale
|
128
|
+
//=require ../../../lib/leaflet/src/control/Control.Scale.js
|
129
|
+
|
130
|
+
// ControlLayers
|
131
|
+
//=require ../../../lib/leaflet/src/control/Control.Layers.js
|
132
|
+
|
133
|
+
// AnimationPan
|
134
|
+
//=require ../../../lib/leaflet/src/dom/PosAnimation.js
|
135
|
+
//=require ../../../lib/leaflet/src/map/anim/Map.PanAnimation.js
|
136
|
+
|
137
|
+
// AnimationTimer
|
138
|
+
//=require ../../../lib/leaflet/src/dom/PosAnimation.Timer.js
|
139
|
+
|
140
|
+
// AnimationZoom
|
141
|
+
//=require ../../../lib/leaflet/src/map/anim/Map.ZoomAnimation.js
|
142
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.Anim.js
|
143
|
+
|
144
|
+
// Geolocation
|
145
|
+
//=require ../../../lib/leaflet/src/map/ext/Map.Geolocation.js
|