leaflet-with-dashoffset-canvas-fix 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2191 -0
- package/LICENSE +26 -0
- package/README.md +3 -0
- package/package.json +149 -0
- package/src/Leaflet.js +24 -0
- package/src/control/Control.Attribution.js +148 -0
- package/src/control/Control.Layers.js +443 -0
- package/src/control/Control.Scale.js +132 -0
- package/src/control/Control.Zoom.js +146 -0
- package/src/control/Control.js +174 -0
- package/src/control/index.js +17 -0
- package/src/core/Browser.js +220 -0
- package/src/core/Class.js +135 -0
- package/src/core/Events.js +344 -0
- package/src/core/Handler.js +57 -0
- package/src/core/Util.js +241 -0
- package/src/core/index.js +15 -0
- package/src/dom/DomEvent.DoubleTap.js +91 -0
- package/src/dom/DomEvent.Pointer.js +97 -0
- package/src/dom/DomEvent.js +315 -0
- package/src/dom/DomUtil.js +349 -0
- package/src/dom/Draggable.js +220 -0
- package/src/dom/PosAnimation.js +113 -0
- package/src/dom/index.js +9 -0
- package/src/geo/LatLng.js +137 -0
- package/src/geo/LatLngBounds.js +251 -0
- package/src/geo/crs/CRS.EPSG3395.js +20 -0
- package/src/geo/crs/CRS.EPSG3857.js +27 -0
- package/src/geo/crs/CRS.EPSG4326.js +23 -0
- package/src/geo/crs/CRS.Earth.js +33 -0
- package/src/geo/crs/CRS.Simple.js +36 -0
- package/src/geo/crs/CRS.js +139 -0
- package/src/geo/crs/index.js +15 -0
- package/src/geo/index.js +7 -0
- package/src/geo/projection/Projection.LonLat.js +28 -0
- package/src/geo/projection/Projection.Mercator.js +49 -0
- package/src/geo/projection/Projection.SphericalMercator.js +44 -0
- package/src/geo/projection/index.js +26 -0
- package/src/geometry/Bounds.js +219 -0
- package/src/geometry/LineUtil.js +306 -0
- package/src/geometry/Point.js +222 -0
- package/src/geometry/PolyUtil.js +129 -0
- package/src/geometry/Transformation.js +79 -0
- package/src/geometry/index.js +8 -0
- package/src/images/layers.svg +1 -0
- package/src/images/logo.svg +1 -0
- package/src/images/marker.svg +1 -0
- package/src/layer/DivOverlay.js +348 -0
- package/src/layer/FeatureGroup.js +94 -0
- package/src/layer/GeoJSON.js +452 -0
- package/src/layer/ImageOverlay.js +270 -0
- package/src/layer/Layer.js +275 -0
- package/src/layer/LayerGroup.js +159 -0
- package/src/layer/Popup.js +506 -0
- package/src/layer/SVGOverlay.js +50 -0
- package/src/layer/Tooltip.js +444 -0
- package/src/layer/VideoOverlay.js +106 -0
- package/src/layer/index.js +24 -0
- package/src/layer/marker/DivIcon.js +74 -0
- package/src/layer/marker/Icon.Default.js +66 -0
- package/src/layer/marker/Icon.js +165 -0
- package/src/layer/marker/Marker.Drag.js +161 -0
- package/src/layer/marker/Marker.js +419 -0
- package/src/layer/marker/index.js +8 -0
- package/src/layer/tile/GridLayer.js +923 -0
- package/src/layer/tile/TileLayer.WMS.js +137 -0
- package/src/layer/tile/TileLayer.js +289 -0
- package/src/layer/tile/index.js +6 -0
- package/src/layer/vector/Canvas.js +493 -0
- package/src/layer/vector/Circle.js +113 -0
- package/src/layer/vector/CircleMarker.js +109 -0
- package/src/layer/vector/Path.js +148 -0
- package/src/layer/vector/Polygon.js +159 -0
- package/src/layer/vector/Polyline.js +307 -0
- package/src/layer/vector/Rectangle.js +57 -0
- package/src/layer/vector/Renderer.getRenderer.js +45 -0
- package/src/layer/vector/Renderer.js +133 -0
- package/src/layer/vector/SVG.Util.js +39 -0
- package/src/layer/vector/SVG.VML.js +144 -0
- package/src/layer/vector/SVG.js +207 -0
- package/src/layer/vector/index.js +14 -0
- package/src/map/Map.js +1751 -0
- package/src/map/handler/Map.BoxZoom.js +152 -0
- package/src/map/handler/Map.DoubleClickZoom.js +55 -0
- package/src/map/handler/Map.Drag.js +235 -0
- package/src/map/handler/Map.Keyboard.js +183 -0
- package/src/map/handler/Map.ScrollWheelZoom.js +91 -0
- package/src/map/handler/Map.TapHold.js +102 -0
- package/src/map/handler/Map.TouchZoom.js +130 -0
- package/src/map/index.js +17 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {Map} from '../Map';
|
|
2
|
+
import {Handler} from '../../core/Handler';
|
|
3
|
+
import * as DomEvent from '../../dom/DomEvent';
|
|
4
|
+
import {Point} from '../../geometry/Point';
|
|
5
|
+
import * as Util from '../../core/Util';
|
|
6
|
+
import Browser from '../../core/Browser';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* L.Map.TapHold is used to simulate `contextmenu` event on long hold,
|
|
10
|
+
* which otherwise is not fired by mobile Safari.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var tapHoldDelay = 600;
|
|
14
|
+
|
|
15
|
+
// @namespace Map
|
|
16
|
+
// @section Interaction Options
|
|
17
|
+
Map.mergeOptions({
|
|
18
|
+
// @section Touch interaction options
|
|
19
|
+
// @option tapHold: Boolean
|
|
20
|
+
// Enables simulation of `contextmenu` event, default is `true` for mobile Safari.
|
|
21
|
+
tapHold: Browser.touchNative && Browser.safari && Browser.mobile,
|
|
22
|
+
|
|
23
|
+
// @option tapTolerance: Number = 15
|
|
24
|
+
// The max number of pixels a user can shift his finger during touch
|
|
25
|
+
// for it to be considered a valid tap.
|
|
26
|
+
tapTolerance: 15
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export var TapHold = Handler.extend({
|
|
30
|
+
addHooks: function () {
|
|
31
|
+
DomEvent.on(this._map._container, 'touchstart', this._onDown, this);
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
removeHooks: function () {
|
|
35
|
+
DomEvent.off(this._map._container, 'touchstart', this._onDown, this);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
_onDown: function (e) {
|
|
39
|
+
clearTimeout(this._holdTimeout);
|
|
40
|
+
if (e.touches.length !== 1) { return; }
|
|
41
|
+
|
|
42
|
+
var first = e.touches[0];
|
|
43
|
+
this._startPos = this._newPos = new Point(first.clientX, first.clientY);
|
|
44
|
+
|
|
45
|
+
this._holdTimeout = setTimeout(Util.bind(function () {
|
|
46
|
+
this._cancel();
|
|
47
|
+
if (!this._isTapValid()) { return; }
|
|
48
|
+
|
|
49
|
+
// prevent simulated mouse events https://w3c.github.io/touch-events/#mouse-events
|
|
50
|
+
DomEvent.on(document, 'touchend', DomEvent.preventDefault);
|
|
51
|
+
DomEvent.on(document, 'touchend touchcancel', this._cancelClickPrevent);
|
|
52
|
+
this._simulateEvent('contextmenu', first);
|
|
53
|
+
}, this), tapHoldDelay);
|
|
54
|
+
|
|
55
|
+
DomEvent.on(document, 'touchend touchcancel contextmenu', this._cancel, this);
|
|
56
|
+
DomEvent.on(document, 'touchmove', this._onMove, this);
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
_cancelClickPrevent: function cancelClickPrevent() {
|
|
60
|
+
DomEvent.off(document, 'touchend', DomEvent.preventDefault);
|
|
61
|
+
DomEvent.off(document, 'touchend touchcancel', cancelClickPrevent);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
_cancel: function () {
|
|
65
|
+
clearTimeout(this._holdTimeout);
|
|
66
|
+
DomEvent.off(document, 'touchend touchcancel contextmenu', this._cancel, this);
|
|
67
|
+
DomEvent.off(document, 'touchmove', this._onMove, this);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
_onMove: function (e) {
|
|
71
|
+
var first = e.touches[0];
|
|
72
|
+
this._newPos = new Point(first.clientX, first.clientY);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
_isTapValid: function () {
|
|
76
|
+
return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
_simulateEvent: function (type, e) {
|
|
80
|
+
var simulatedEvent = new MouseEvent(type, {
|
|
81
|
+
bubbles: true,
|
|
82
|
+
cancelable: true,
|
|
83
|
+
view: window,
|
|
84
|
+
// detail: 1,
|
|
85
|
+
screenX: e.screenX,
|
|
86
|
+
screenY: e.screenY,
|
|
87
|
+
clientX: e.clientX,
|
|
88
|
+
clientY: e.clientY,
|
|
89
|
+
// button: 2,
|
|
90
|
+
// buttons: 2
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
simulatedEvent._simulated = true;
|
|
94
|
+
|
|
95
|
+
e.target.dispatchEvent(simulatedEvent);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// @section Handlers
|
|
100
|
+
// @property tapHold: Handler
|
|
101
|
+
// Long tap handler to simulate `contextmenu` event (useful in mobile Safari).
|
|
102
|
+
Map.addInitHook('addHandler', 'tapHold', TapHold);
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {Map} from '../Map';
|
|
2
|
+
import {Handler} from '../../core/Handler';
|
|
3
|
+
import * as DomEvent from '../../dom/DomEvent';
|
|
4
|
+
import * as Util from '../../core/Util';
|
|
5
|
+
import * as DomUtil from '../../dom/DomUtil';
|
|
6
|
+
import Browser from '../../core/Browser';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// @namespace Map
|
|
13
|
+
// @section Interaction Options
|
|
14
|
+
Map.mergeOptions({
|
|
15
|
+
// @section Touch interaction options
|
|
16
|
+
// @option touchZoom: Boolean|String = *
|
|
17
|
+
// Whether the map can be zoomed by touch-dragging with two fingers. If
|
|
18
|
+
// passed `'center'`, it will zoom to the center of the view regardless of
|
|
19
|
+
// where the touch events (fingers) were. Enabled for touch-capable web
|
|
20
|
+
// browsers.
|
|
21
|
+
touchZoom: Browser.touch,
|
|
22
|
+
|
|
23
|
+
// @option bounceAtZoomLimits: Boolean = true
|
|
24
|
+
// Set it to false if you don't want the map to zoom beyond min/max zoom
|
|
25
|
+
// and then bounce back when pinch-zooming.
|
|
26
|
+
bounceAtZoomLimits: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export var TouchZoom = Handler.extend({
|
|
30
|
+
addHooks: function () {
|
|
31
|
+
DomUtil.addClass(this._map._container, 'leaflet-touch-zoom');
|
|
32
|
+
DomEvent.on(this._map._container, 'touchstart', this._onTouchStart, this);
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
removeHooks: function () {
|
|
36
|
+
DomUtil.removeClass(this._map._container, 'leaflet-touch-zoom');
|
|
37
|
+
DomEvent.off(this._map._container, 'touchstart', this._onTouchStart, this);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
_onTouchStart: function (e) {
|
|
41
|
+
var map = this._map;
|
|
42
|
+
if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
|
|
43
|
+
|
|
44
|
+
var p1 = map.mouseEventToContainerPoint(e.touches[0]),
|
|
45
|
+
p2 = map.mouseEventToContainerPoint(e.touches[1]);
|
|
46
|
+
|
|
47
|
+
this._centerPoint = map.getSize()._divideBy(2);
|
|
48
|
+
this._startLatLng = map.containerPointToLatLng(this._centerPoint);
|
|
49
|
+
if (map.options.touchZoom !== 'center') {
|
|
50
|
+
this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this._startDist = p1.distanceTo(p2);
|
|
54
|
+
this._startZoom = map.getZoom();
|
|
55
|
+
|
|
56
|
+
this._moved = false;
|
|
57
|
+
this._zooming = true;
|
|
58
|
+
|
|
59
|
+
map._stop();
|
|
60
|
+
|
|
61
|
+
DomEvent.on(document, 'touchmove', this._onTouchMove, this);
|
|
62
|
+
DomEvent.on(document, 'touchend touchcancel', this._onTouchEnd, this);
|
|
63
|
+
|
|
64
|
+
DomEvent.preventDefault(e);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
_onTouchMove: function (e) {
|
|
68
|
+
if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
|
|
69
|
+
|
|
70
|
+
var map = this._map,
|
|
71
|
+
p1 = map.mouseEventToContainerPoint(e.touches[0]),
|
|
72
|
+
p2 = map.mouseEventToContainerPoint(e.touches[1]),
|
|
73
|
+
scale = p1.distanceTo(p2) / this._startDist;
|
|
74
|
+
|
|
75
|
+
this._zoom = map.getScaleZoom(scale, this._startZoom);
|
|
76
|
+
|
|
77
|
+
if (!map.options.bounceAtZoomLimits && (
|
|
78
|
+
(this._zoom < map.getMinZoom() && scale < 1) ||
|
|
79
|
+
(this._zoom > map.getMaxZoom() && scale > 1))) {
|
|
80
|
+
this._zoom = map._limitZoom(this._zoom);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (map.options.touchZoom === 'center') {
|
|
84
|
+
this._center = this._startLatLng;
|
|
85
|
+
if (scale === 1) { return; }
|
|
86
|
+
} else {
|
|
87
|
+
// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
|
|
88
|
+
var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
|
|
89
|
+
if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
|
|
90
|
+
this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!this._moved) {
|
|
94
|
+
map._moveStart(true, false);
|
|
95
|
+
this._moved = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Util.cancelAnimFrame(this._animRequest);
|
|
99
|
+
|
|
100
|
+
var moveFn = Util.bind(map._move, map, this._center, this._zoom, {pinch: true, round: false}, undefined);
|
|
101
|
+
this._animRequest = Util.requestAnimFrame(moveFn, this, true);
|
|
102
|
+
|
|
103
|
+
DomEvent.preventDefault(e);
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
_onTouchEnd: function () {
|
|
107
|
+
if (!this._moved || !this._zooming) {
|
|
108
|
+
this._zooming = false;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this._zooming = false;
|
|
113
|
+
Util.cancelAnimFrame(this._animRequest);
|
|
114
|
+
|
|
115
|
+
DomEvent.off(document, 'touchmove', this._onTouchMove, this);
|
|
116
|
+
DomEvent.off(document, 'touchend touchcancel', this._onTouchEnd, this);
|
|
117
|
+
|
|
118
|
+
// Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.
|
|
119
|
+
if (this._map.options.zoomAnimation) {
|
|
120
|
+
this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);
|
|
121
|
+
} else {
|
|
122
|
+
this._map._resetView(this._center, this._map._limitZoom(this._zoom));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// @section Handlers
|
|
128
|
+
// @property touchZoom: Handler
|
|
129
|
+
// Touch zoom handler.
|
|
130
|
+
Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
|
package/src/map/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {Map} from './Map';
|
|
2
|
+
import {BoxZoom} from './handler/Map.BoxZoom';
|
|
3
|
+
Map.BoxZoom = BoxZoom;
|
|
4
|
+
import {DoubleClickZoom} from './handler/Map.DoubleClickZoom';
|
|
5
|
+
Map.DoubleClickZoom = DoubleClickZoom;
|
|
6
|
+
import {Drag} from './handler/Map.Drag';
|
|
7
|
+
Map.Drag = Drag;
|
|
8
|
+
import {Keyboard} from './handler/Map.Keyboard';
|
|
9
|
+
Map.Keyboard = Keyboard;
|
|
10
|
+
import {ScrollWheelZoom} from './handler/Map.ScrollWheelZoom';
|
|
11
|
+
Map.ScrollWheelZoom = ScrollWheelZoom;
|
|
12
|
+
import {TapHold} from './handler/Map.TapHold';
|
|
13
|
+
Map.TapHold = TapHold;
|
|
14
|
+
import {TouchZoom} from './handler/Map.TouchZoom';
|
|
15
|
+
Map.TouchZoom = TouchZoom;
|
|
16
|
+
|
|
17
|
+
export {Map, createMap as map} from './Map';
|