maplair 4.0.0-alpha.1
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 +2804 -0
- package/LICENSE +27 -0
- package/README.md +40 -0
- package/dist/esm/Maplair.js +71 -0
- package/dist/esm/Maplair.js.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.js +13 -0
- package/dist/esm/control/AttributionControl.js +79 -0
- package/dist/esm/control/AttributionControl.js.map +1 -0
- package/dist/esm/control/Control.js +81 -0
- package/dist/esm/control/Control.js.map +1 -0
- package/dist/esm/control/LayersControl.js +220 -0
- package/dist/esm/control/LayersControl.js.map +1 -0
- package/dist/esm/control/ScaleControl.js +72 -0
- package/dist/esm/control/ScaleControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +86 -0
- package/dist/esm/control/ZoomControl.js.map +1 -0
- package/dist/esm/core/Browser.js +31 -0
- package/dist/esm/core/Browser.js.map +1 -0
- package/dist/esm/core/Class.js +52 -0
- package/dist/esm/core/Class.js.map +1 -0
- package/dist/esm/core/Events.js +149 -0
- package/dist/esm/core/Events.js.map +1 -0
- package/dist/esm/core/Handler.js +32 -0
- package/dist/esm/core/Handler.js.map +1 -0
- package/dist/esm/core/I18n.js +36 -0
- package/dist/esm/core/I18n.js.map +1 -0
- package/dist/esm/core/Util.js +71 -0
- package/dist/esm/core/Util.js.map +1 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js +74 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js +46 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -0
- package/dist/esm/dom/DomEvent.js +135 -0
- package/dist/esm/dom/DomEvent.js.map +1 -0
- package/dist/esm/dom/DomUtil.js +107 -0
- package/dist/esm/dom/DomUtil.js.map +1 -0
- package/dist/esm/dom/Draggable.js +107 -0
- package/dist/esm/dom/Draggable.js.map +1 -0
- package/dist/esm/dom/PosAnimation.js +56 -0
- package/dist/esm/dom/PosAnimation.js.map +1 -0
- package/dist/esm/geo/LatLng.js +65 -0
- package/dist/esm/geo/LatLng.js.map +1 -0
- package/dist/esm/geo/LatLngBounds.js +114 -0
- package/dist/esm/geo/LatLngBounds.js.map +1 -0
- package/dist/esm/geo/crs/CRS.js +51 -0
- package/dist/esm/geo/crs/CRS.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3395.js +16 -0
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3857.js +19 -0
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -0
- package/dist/esm/geo/crs/EPSG4326.js +13 -0
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -0
- package/dist/esm/geo/crs/EarthCRS.js +14 -0
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -0
- package/dist/esm/geo/crs/SimpleCRS.js +23 -0
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -0
- package/dist/esm/geo/projection/Projection.LonLat.js +19 -0
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -0
- package/dist/esm/geo/projection/Projection.Mercator.js +33 -0
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +27 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -0
- package/dist/esm/geo/projection/index.js +14 -0
- package/dist/esm/geo/projection/index.js.map +1 -0
- package/dist/esm/geometry/Bounds.js +91 -0
- package/dist/esm/geometry/Bounds.js.map +1 -0
- package/dist/esm/geometry/LineUtil.js +169 -0
- package/dist/esm/geometry/LineUtil.js.map +1 -0
- package/dist/esm/geometry/Point.js +119 -0
- package/dist/esm/geometry/Point.js.map +1 -0
- package/dist/esm/geometry/PolyUtil.js +89 -0
- package/dist/esm/geometry/PolyUtil.js.map +1 -0
- package/dist/esm/geometry/Transformation.js +34 -0
- package/dist/esm/geometry/Transformation.js.map +1 -0
- package/dist/esm/layer/BlanketOverlay.js +87 -0
- package/dist/esm/layer/BlanketOverlay.js.map +1 -0
- package/dist/esm/layer/DivOverlay.js +192 -0
- package/dist/esm/layer/DivOverlay.js.map +1 -0
- package/dist/esm/layer/FeatureGroup.js +40 -0
- package/dist/esm/layer/FeatureGroup.js.map +1 -0
- package/dist/esm/layer/GeoJSON.js +192 -0
- package/dist/esm/layer/GeoJSON.js.map +1 -0
- package/dist/esm/layer/ImageOverlay.js +140 -0
- package/dist/esm/layer/ImageOverlay.js.map +1 -0
- package/dist/esm/layer/Layer.js +119 -0
- package/dist/esm/layer/Layer.js.map +1 -0
- package/dist/esm/layer/LayerGroup.js +58 -0
- package/dist/esm/layer/LayerGroup.js.map +1 -0
- package/dist/esm/layer/Popup.js +224 -0
- package/dist/esm/layer/Popup.js.map +1 -0
- package/dist/esm/layer/SVGOverlay.js +21 -0
- package/dist/esm/layer/SVGOverlay.js.map +1 -0
- package/dist/esm/layer/Tooltip.js +228 -0
- package/dist/esm/layer/Tooltip.js.map +1 -0
- package/dist/esm/layer/VideoOverlay.js +54 -0
- package/dist/esm/layer/VideoOverlay.js.map +1 -0
- package/dist/esm/layer/marker/DefaultIcon.js +50 -0
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -0
- package/dist/esm/layer/marker/DivIcon.js +37 -0
- package/dist/esm/layer/marker/DivIcon.js.map +1 -0
- package/dist/esm/layer/marker/Icon.js +65 -0
- package/dist/esm/layer/marker/Icon.js.map +1 -0
- package/dist/esm/layer/marker/Marker.Drag.js +77 -0
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -0
- package/dist/esm/layer/marker/Marker.js +235 -0
- package/dist/esm/layer/marker/Marker.js.map +1 -0
- package/dist/esm/layer/tile/GridLayer.js +447 -0
- package/dist/esm/layer/tile/GridLayer.js.map +1 -0
- package/dist/esm/layer/tile/TileLayer.js +139 -0
- package/dist/esm/layer/tile/TileLayer.js.map +1 -0
- package/dist/esm/layer/tile/WMSTileLayer.js +68 -0
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -0
- package/dist/esm/layer/vector/Canvas.js +292 -0
- package/dist/esm/layer/vector/Canvas.js.map +1 -0
- package/dist/esm/layer/vector/Circle.js +35 -0
- package/dist/esm/layer/vector/Circle.js.map +1 -0
- package/dist/esm/layer/vector/CircleMarker.js +69 -0
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -0
- package/dist/esm/layer/vector/Path.js +68 -0
- package/dist/esm/layer/vector/Path.js.map +1 -0
- package/dist/esm/layer/vector/Polygon.js +70 -0
- package/dist/esm/layer/vector/Polygon.js.map +1 -0
- package/dist/esm/layer/vector/Polyline.js +152 -0
- package/dist/esm/layer/vector/Polyline.js.map +1 -0
- package/dist/esm/layer/vector/Rectangle.js +25 -0
- package/dist/esm/layer/vector/Rectangle.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js +31 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.js +39 -0
- package/dist/esm/layer/vector/Renderer.js.map +1 -0
- package/dist/esm/layer/vector/SVG.js +115 -0
- package/dist/esm/layer/vector/SVG.js.map +1 -0
- package/dist/esm/map/Map.js +844 -0
- package/dist/esm/map/Map.js.map +1 -0
- package/dist/esm/map/handler/BoxZoomHandler.js +105 -0
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js +27 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DragHandler.js +133 -0
- package/dist/esm/map/handler/DragHandler.js.map +1 -0
- package/dist/esm/map/handler/KeyboardHandler.js +117 -0
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -0
- package/dist/esm/map/handler/PinchZoomHandler.js +96 -0
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +50 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/TapHoldHandler.js +77 -0
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -0
- package/dist/esm/package.js +6 -0
- package/dist/esm/package.js.map +1 -0
- package/dist/images/layers.svg +1 -0
- package/dist/images/logo.svg +1 -0
- package/dist/images/marker-icon.svg +1 -0
- package/dist/images/marker-shadow.svg +1 -0
- package/dist/maplair-global-src.js +6810 -0
- package/dist/maplair-global-src.js.map +1 -0
- package/dist/maplair-global.js +12 -0
- package/dist/maplair-global.js.map +1 -0
- package/dist/maplair-src.js +6704 -0
- package/dist/maplair-src.js.map +1 -0
- package/dist/maplair.css +730 -0
- package/dist/maplair.js +7 -0
- package/dist/maplair.js.map +1 -0
- package/i18n/cs.json +12 -0
- package/i18n/de.json +12 -0
- package/i18n/en.json +12 -0
- package/i18n/es.json +12 -0
- package/i18n/fr.json +12 -0
- package/i18n/hu.json +12 -0
- package/i18n/it.json +12 -0
- package/i18n/rm.json +12 -0
- package/i18n/sk.json +12 -0
- package/i18n/sl.json +12 -0
- package/package.json +87 -0
- package/src/Maplair.js +24 -0
- package/src/control/AttributionControl.js +147 -0
- package/src/control/Control.js +174 -0
- package/src/control/LayersControl.js +444 -0
- package/src/control/ScaleControl.js +141 -0
- package/src/control/ZoomControl.js +147 -0
- package/src/control/index.js +5 -0
- package/src/core/Browser.js +75 -0
- package/src/core/Class.js +97 -0
- package/src/core/Events.js +334 -0
- package/src/core/Handler.js +59 -0
- package/src/core/I18n.js +76 -0
- package/src/core/Util.js +122 -0
- package/src/core/index.js +8 -0
- package/src/dom/DomEvent.DoubleTap.js +120 -0
- package/src/dom/DomEvent.PointerEvents.js +75 -0
- package/src/dom/DomEvent.js +282 -0
- package/src/dom/DomUtil.js +175 -0
- package/src/dom/Draggable.js +204 -0
- package/src/dom/PosAnimation.js +115 -0
- package/src/dom/index.js +9 -0
- package/src/geo/LatLng.js +163 -0
- package/src/geo/LatLngBounds.js +260 -0
- package/src/geo/crs/CRS.js +143 -0
- package/src/geo/crs/EPSG3395.js +19 -0
- package/src/geo/crs/EPSG3857.js +26 -0
- package/src/geo/crs/EPSG4326.js +21 -0
- package/src/geo/crs/EarthCRS.js +32 -0
- package/src/geo/crs/SimpleCRS.js +35 -0
- package/src/geo/crs/index.js +6 -0
- package/src/geo/index.js +7 -0
- package/src/geo/projection/Projection.LonLat.js +30 -0
- package/src/geo/projection/Projection.Mercator.js +53 -0
- package/src/geo/projection/Projection.SphericalMercator.js +46 -0
- package/src/geo/projection/index.js +26 -0
- package/src/geometry/Bounds.js +222 -0
- package/src/geometry/LineUtil.js +299 -0
- package/src/geometry/Point.js +239 -0
- package/src/geometry/PolyUtil.js +129 -0
- package/src/geometry/Transformation.js +67 -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-icon.svg +1 -0
- package/src/images/marker-shadow.svg +1 -0
- package/src/layer/BlanketOverlay.js +171 -0
- package/src/layer/DivOverlay.js +353 -0
- package/src/layer/FeatureGroup.js +93 -0
- package/src/layer/GeoJSON.js +432 -0
- package/src/layer/ImageOverlay.js +279 -0
- package/src/layer/Layer.js +273 -0
- package/src/layer/LayerGroup.js +129 -0
- package/src/layer/Popup.js +528 -0
- package/src/layer/SVGOverlay.js +47 -0
- package/src/layer/Tooltip.js +469 -0
- package/src/layer/VideoOverlay.js +111 -0
- package/src/layer/index.js +18 -0
- package/src/layer/marker/DefaultIcon.js +79 -0
- package/src/layer/marker/DivIcon.js +76 -0
- package/src/layer/marker/Icon.js +164 -0
- package/src/layer/marker/Marker.Drag.js +161 -0
- package/src/layer/marker/Marker.js +465 -0
- package/src/layer/marker/index.js +5 -0
- package/src/layer/tile/GridLayer.js +901 -0
- package/src/layer/tile/TileLayer.js +299 -0
- package/src/layer/tile/WMSTileLayer.js +133 -0
- package/src/layer/tile/index.js +3 -0
- package/src/layer/vector/Canvas.js +479 -0
- package/src/layer/vector/Circle.js +87 -0
- package/src/layer/vector/CircleMarker.js +110 -0
- package/src/layer/vector/Path.js +145 -0
- package/src/layer/vector/Polygon.js +160 -0
- package/src/layer/vector/Polyline.js +296 -0
- package/src/layer/vector/Rectangle.js +52 -0
- package/src/layer/vector/Renderer.getRenderer.js +48 -0
- package/src/layer/vector/Renderer.js +75 -0
- package/src/layer/vector/SVG.js +216 -0
- package/src/layer/vector/index.js +10 -0
- package/src/map/Map.js +1830 -0
- package/src/map/handler/BoxZoomHandler.js +156 -0
- package/src/map/handler/DoubleClickZoomHandler.js +62 -0
- package/src/map/handler/DragHandler.js +240 -0
- package/src/map/handler/KeyboardHandler.js +188 -0
- package/src/map/handler/PinchZoomHandler.js +157 -0
- package/src/map/handler/ScrollWheelZoomHandler.js +98 -0
- package/src/map/handler/TapHoldHandler.js +111 -0
- package/src/map/index.js +8 -0
- package/src/maplair.css +730 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
import {Control} from './Control.js';
|
|
3
|
+
import * as DomUtil from '../dom/DomUtil.js';
|
|
4
|
+
import * as DomEvent from '../dom/DomEvent.js';
|
|
5
|
+
import {I18n} from '../core/I18n.js';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* @class ZoomControl
|
|
9
|
+
* @inherits Control
|
|
10
|
+
*
|
|
11
|
+
* A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// @namespace ZoomControl
|
|
15
|
+
// @constructor ZoomControl(options: ZoomControl options)
|
|
16
|
+
// Creates a zoom control
|
|
17
|
+
export class ZoomControl extends Control {
|
|
18
|
+
|
|
19
|
+
static {
|
|
20
|
+
// @section
|
|
21
|
+
// @aka ZoomControl options
|
|
22
|
+
this.setDefaultOptions({
|
|
23
|
+
// @option position: String = 'topleft'
|
|
24
|
+
// The position of the control (one of the map corners). Possible values are `'topleft'`,
|
|
25
|
+
// `'topright'`, `'bottomleft'` or `'bottomright'`
|
|
26
|
+
position: 'topleft',
|
|
27
|
+
|
|
28
|
+
// @option zoomInText: String = '<span aria-hidden="true">+</span>'
|
|
29
|
+
// The text set on the 'zoom in' button.
|
|
30
|
+
zoomInText: '<span aria-hidden="true">+</span>',
|
|
31
|
+
|
|
32
|
+
// @option zoomOutText: String = '<span aria-hidden="true">−</span>'
|
|
33
|
+
// The text set on the 'zoom out' button.
|
|
34
|
+
zoomOutText: '<span aria-hidden="true">−</span>',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
constructor(...args) {
|
|
39
|
+
super(...args);
|
|
40
|
+
this.callInitHooks(ZoomControl);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onAdd(map) {
|
|
44
|
+
const zoomName = 'maplair-control-zoom',
|
|
45
|
+
container = DomUtil.create('div', `${zoomName} maplair-bar`),
|
|
46
|
+
options = this.options;
|
|
47
|
+
|
|
48
|
+
this._zoomInButton = this._createButton(options.zoomInText, I18n.translate('Zoom in'),
|
|
49
|
+
`${zoomName}-in`, container, this._zoomIn);
|
|
50
|
+
this._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate('Zoom out'),
|
|
51
|
+
`${zoomName}-out`, container, this._zoomOut);
|
|
52
|
+
|
|
53
|
+
this._updateDisabled();
|
|
54
|
+
map.on('zoomend zoomlevelschange', this._updateDisabled, this);
|
|
55
|
+
|
|
56
|
+
return container;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onRemove(map) {
|
|
60
|
+
map.off('zoomend zoomlevelschange', this._updateDisabled, this);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
disable() {
|
|
64
|
+
this._disabled = true;
|
|
65
|
+
this._updateDisabled();
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
enable() {
|
|
70
|
+
this._disabled = false;
|
|
71
|
+
this._updateDisabled();
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_zoomIn(e) {
|
|
76
|
+
if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
|
|
77
|
+
this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_zoomOut(e) {
|
|
82
|
+
if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
|
|
83
|
+
this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_createButton(html, title, className, container, fn) {
|
|
88
|
+
const link = DomUtil.create('a', className, container);
|
|
89
|
+
link.innerHTML = html;
|
|
90
|
+
link.href = '#';
|
|
91
|
+
link.title = title;
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* Will force screen readers like VoiceOver to read this as "Zoom in - button"
|
|
95
|
+
*/
|
|
96
|
+
link.setAttribute('role', 'button');
|
|
97
|
+
link.setAttribute('aria-label', title);
|
|
98
|
+
|
|
99
|
+
DomEvent.disableClickPropagation(link);
|
|
100
|
+
DomEvent.on(link, 'click', DomEvent.stop);
|
|
101
|
+
DomEvent.on(link, 'click', fn, this);
|
|
102
|
+
DomEvent.on(link, 'click', this._refocusOnMap, this);
|
|
103
|
+
|
|
104
|
+
return link;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
_updateDisabled() {
|
|
108
|
+
const map = this._map,
|
|
109
|
+
className = 'maplair-disabled';
|
|
110
|
+
|
|
111
|
+
this._zoomInButton.classList.remove(className);
|
|
112
|
+
this._zoomOutButton.classList.remove(className);
|
|
113
|
+
this._zoomInButton.setAttribute('aria-disabled', 'false');
|
|
114
|
+
this._zoomOutButton.setAttribute('aria-disabled', 'false');
|
|
115
|
+
|
|
116
|
+
if (this._disabled || map._zoom === map.getMinZoom()) {
|
|
117
|
+
this._zoomOutButton.classList.add(className);
|
|
118
|
+
this._zoomOutButton.setAttribute('aria-disabled', 'true');
|
|
119
|
+
}
|
|
120
|
+
if (this._disabled || map._zoom === map.getMaxZoom()) {
|
|
121
|
+
this._zoomInButton.classList.add(className);
|
|
122
|
+
this._zoomInButton.setAttribute('aria-disabled', 'true');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Registers this default feature on the map class, called by `MaplairMap` itself.
|
|
127
|
+
static register(MaplairMap) {
|
|
128
|
+
// @namespace MaplairMap
|
|
129
|
+
// @section Control options
|
|
130
|
+
// @option zoomControl: Boolean = true
|
|
131
|
+
// Whether a [zoom control](#control-zoom) is added to the map by default.
|
|
132
|
+
MaplairMap.mergeOptions({
|
|
133
|
+
zoomControl: true
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
MaplairMap.addInitHook(function () {
|
|
137
|
+
if (this.options.zoomControl) {
|
|
138
|
+
// @section Controls
|
|
139
|
+
// @property zoomControl: ZoomControl
|
|
140
|
+
// The default zoom control (only available if the
|
|
141
|
+
// [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).
|
|
142
|
+
this.zoomControl = new ZoomControl();
|
|
143
|
+
this.addControl(this.zoomControl);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @namespace Browser
|
|
3
|
+
*
|
|
4
|
+
* A namespace with static properties for browser/feature detection used by Maplair internally.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* if (Browser.chrome) {
|
|
10
|
+
* alert('You are running Chrome!');
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// @property chrome: Boolean; `true` for the Chrome browser.
|
|
16
|
+
const chrome = userAgentContains('chrome');
|
|
17
|
+
|
|
18
|
+
// @property safari: Boolean; `true` for the Safari browser.
|
|
19
|
+
const safari = !chrome && userAgentContains('safari');
|
|
20
|
+
|
|
21
|
+
// @property mobile: Boolean; `true` for all browsers running in a mobile device.
|
|
22
|
+
const mobile = typeof orientation !== 'undefined';
|
|
23
|
+
|
|
24
|
+
// @property reducedMotion: Boolean
|
|
25
|
+
// `true` if the user has [configured their environment for reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion#user_preferences).
|
|
26
|
+
// Determines whether animations should play or not.
|
|
27
|
+
const reducedMotion = navigator.preferences?.reducedMotion?.value ?
|
|
28
|
+
navigator.preferences.reducedMotion.value === 'reduce' :
|
|
29
|
+
typeof window === 'undefined' ? true : window?.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
30
|
+
|
|
31
|
+
// @property pointer: Boolean
|
|
32
|
+
// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
|
|
33
|
+
const pointer = typeof window === 'undefined' ? false : !!window.PointerEvent;
|
|
34
|
+
|
|
35
|
+
// @property touchNative: Boolean
|
|
36
|
+
// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
|
|
37
|
+
// **This does not necessarily mean** that the browser is running in a computer with
|
|
38
|
+
// a touchscreen, it only means that the browser is capable of understanding
|
|
39
|
+
// touch events.
|
|
40
|
+
const touchNative = typeof window === 'undefined' ? false : 'ontouchstart' in window || !!(window.TouchEvent);
|
|
41
|
+
|
|
42
|
+
// @property touch: Boolean
|
|
43
|
+
// `true` for all browsers supporting either [touch](#browser-touch) or [pointer](#browser-pointer) events.
|
|
44
|
+
// Note: pointer events will be preferred (if available), and processed for all `touch*` listeners.
|
|
45
|
+
const touch = touchNative || pointer;
|
|
46
|
+
|
|
47
|
+
// @property retina: Boolean
|
|
48
|
+
// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
|
|
49
|
+
const retina = typeof window === 'undefined' || typeof window.devicePixelRatio === 'undefined' ? false : window.devicePixelRatio > 1;
|
|
50
|
+
|
|
51
|
+
// @property mac: Boolean; `true` when the browser is running in a Mac platform
|
|
52
|
+
const mac = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platform.startsWith('Mac');
|
|
53
|
+
|
|
54
|
+
// @property linux: Boolean; `true` when the browser is running in a Linux platform
|
|
55
|
+
const linux = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platform.startsWith('Linux');
|
|
56
|
+
|
|
57
|
+
function userAgentContains(str) {
|
|
58
|
+
if (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined') {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return navigator.userAgent.toLowerCase().includes(str);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
chrome,
|
|
66
|
+
safari,
|
|
67
|
+
mobile,
|
|
68
|
+
reducedMotion,
|
|
69
|
+
pointer,
|
|
70
|
+
touch,
|
|
71
|
+
touchNative,
|
|
72
|
+
retina,
|
|
73
|
+
mac,
|
|
74
|
+
linux
|
|
75
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as Util from './Util.js';
|
|
2
|
+
|
|
3
|
+
// @class Class
|
|
4
|
+
|
|
5
|
+
// @section
|
|
6
|
+
// @uninheritable
|
|
7
|
+
|
|
8
|
+
// Thanks to John Resig and Dean Edwards for inspiration!
|
|
9
|
+
|
|
10
|
+
export class Class {
|
|
11
|
+
// @function include(properties: Object): this
|
|
12
|
+
// [Includes a mixin](#class-includes) into the current class.
|
|
13
|
+
static include(props) {
|
|
14
|
+
const parentOptions = this.prototype.options;
|
|
15
|
+
for (const k of getAllMethodNames(props)) {
|
|
16
|
+
this.prototype[k] = props[k];
|
|
17
|
+
}
|
|
18
|
+
if (props.options) {
|
|
19
|
+
this.prototype.options = parentOptions;
|
|
20
|
+
this.mergeOptions(props.options);
|
|
21
|
+
}
|
|
22
|
+
return this;
|
|
23
|
+
|
|
24
|
+
function *getAllMethodNames(obj) {
|
|
25
|
+
do {
|
|
26
|
+
if (obj === Object || obj === Object.prototype) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
30
|
+
yield k;
|
|
31
|
+
}
|
|
32
|
+
} while ((obj = Object.getPrototypeOf(obj)) !== undefined);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// @function setDefaultOptions(options: Object): this
|
|
37
|
+
// Configures the [default `options`](#class-options) on the prototype of this class.
|
|
38
|
+
static setDefaultOptions(options) {
|
|
39
|
+
Util.setOptions(this.prototype, options);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// @function mergeOptions(options: Object): this
|
|
44
|
+
// [Merges `options`](#class-options) into the defaults of the class.
|
|
45
|
+
static mergeOptions(options) {
|
|
46
|
+
this.prototype.options ??= {};
|
|
47
|
+
Object.assign(this.prototype.options, options);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// @function addInitHook(fn: Function): this
|
|
52
|
+
// Adds a [constructor hook](#class-constructor-hooks) to the class.
|
|
53
|
+
static addInitHook(fn, ...args) { // (Function) || (String, args...)
|
|
54
|
+
const init = typeof fn === 'function' ? fn : function () {
|
|
55
|
+
this[fn](...args);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (!Object.hasOwn(this, '_initHooks')) { // do not use ??= here, which would find the parent class' hooks
|
|
59
|
+
this._initHooks = [];
|
|
60
|
+
}
|
|
61
|
+
this._initHooks.push(init);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
constructor() {
|
|
66
|
+
Util.setOptions(this);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// @method callInitHooks(cls?: Function): this
|
|
70
|
+
// Runs the [constructor hooks](#class-constructor-hooks) of the given class and
|
|
71
|
+
// of its parent classes, which haven't run yet for this object. Classes call it
|
|
72
|
+
// at the end of their constructor, e.g. `this.callInitHooks(MyClass)`.
|
|
73
|
+
// Without `cls`, runs the hooks of all classes of this object.
|
|
74
|
+
callInitHooks(cls = this.constructor) {
|
|
75
|
+
const done = this._initHooksCalledFor;
|
|
76
|
+
if (done && (done === cls || done.prototype instanceof cls)) {
|
|
77
|
+
return this; // the hooks of `cls` already ran
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// parent classes first; stop at the class whose hooks (and whose parent
|
|
81
|
+
// classes' hooks) already ran, e.g. in the constructor of a parent class
|
|
82
|
+
const classes = [];
|
|
83
|
+
for (let c = cls; c && c !== Function.prototype && c !== done; c = Object.getPrototypeOf(c)) {
|
|
84
|
+
classes.unshift(c);
|
|
85
|
+
}
|
|
86
|
+
this._initHooksCalledFor = cls;
|
|
87
|
+
|
|
88
|
+
for (const c of classes) {
|
|
89
|
+
if (Object.hasOwn(c, '_initHooks')) {
|
|
90
|
+
for (const hook of c._initHooks) {
|
|
91
|
+
hook.call(this);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import {Class} from './Class.js';
|
|
2
|
+
import * as Util from './Util.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* @class Evented
|
|
6
|
+
* @inherits Class
|
|
7
|
+
*
|
|
8
|
+
* A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* map.on('click', function(e) {
|
|
14
|
+
* alert(e.latlng);
|
|
15
|
+
* } );
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Maplair deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
|
|
19
|
+
*
|
|
20
|
+
* ```js
|
|
21
|
+
* function onClick(e) { ... }
|
|
22
|
+
*
|
|
23
|
+
* map.on('click', onClick);
|
|
24
|
+
* map.off('click', onClick);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export class Evented extends Class {
|
|
29
|
+
/* @method on(type: String, fn: Function, context?: Object): this
|
|
30
|
+
* Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).
|
|
31
|
+
*
|
|
32
|
+
* @alternative
|
|
33
|
+
* @method on(eventMap: Object): this
|
|
34
|
+
* Adds a set of type/listener pairs, e.g. `{click: onClick, pointermove: onPointerMove}`
|
|
35
|
+
*/
|
|
36
|
+
on(types, fn, context) {
|
|
37
|
+
|
|
38
|
+
// types can be a map of types/handlers
|
|
39
|
+
if (typeof types === 'object') {
|
|
40
|
+
for (const [type, f] of Object.entries(types)) {
|
|
41
|
+
// we don't process space-separated events here for performance;
|
|
42
|
+
// it's a hot path since Layer uses the on(obj) syntax
|
|
43
|
+
this._on(type, f, fn);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} else {
|
|
47
|
+
// types can be a string of space-separated words
|
|
48
|
+
for (const type of Util.splitWords(types)) {
|
|
49
|
+
this._on(type, fn, context);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* @method off(type: String, fn?: Function, context?: Object): this
|
|
57
|
+
* Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.
|
|
58
|
+
*
|
|
59
|
+
* @alternative
|
|
60
|
+
* @method off(eventMap: Object): this
|
|
61
|
+
* Removes a set of type/listener pairs.
|
|
62
|
+
*
|
|
63
|
+
* @alternative
|
|
64
|
+
* @method off: this
|
|
65
|
+
* Removes all listeners to all events on the object. This includes implicitly attached events.
|
|
66
|
+
*/
|
|
67
|
+
off(types, fn, context) {
|
|
68
|
+
|
|
69
|
+
if (!arguments.length) {
|
|
70
|
+
// clear all listeners if called without arguments
|
|
71
|
+
delete this._events;
|
|
72
|
+
delete this._listenerIndex;
|
|
73
|
+
|
|
74
|
+
} else if (typeof types === 'object') {
|
|
75
|
+
for (const [type, f] of Object.entries(types)) {
|
|
76
|
+
this._off(type, f, fn);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
const removeAll = arguments.length === 1;
|
|
81
|
+
for (const type of Util.splitWords(types)) {
|
|
82
|
+
if (removeAll) {
|
|
83
|
+
this._off(type);
|
|
84
|
+
} else {
|
|
85
|
+
this._off(type, fn, context);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static __REMOVED_EVENTS = ['mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove'];
|
|
94
|
+
|
|
95
|
+
// attach listener (without syntactic sugar now)
|
|
96
|
+
_on(type, fn, context, _once) {
|
|
97
|
+
// To be removed in maplair 3
|
|
98
|
+
if (Evented.__REMOVED_EVENTS.includes(type)) {
|
|
99
|
+
console.error(`The event ${type} has been removed. Use the PointerEvent variant instead.`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (typeof fn !== 'function') {
|
|
103
|
+
console.warn(`wrong listener type: ${typeof fn}`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (context === this) {
|
|
108
|
+
// Less memory footprint.
|
|
109
|
+
context = undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// check if fn already there
|
|
113
|
+
const contexts = this._getListenerIndex(type).get(fn);
|
|
114
|
+
if (contexts?.has(context)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const newListener = {fn, ctx: context};
|
|
119
|
+
if (_once) {
|
|
120
|
+
newListener.once = true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this._events ??= {};
|
|
124
|
+
// a Set keeps the listeners in order, and allows removing them in constant time
|
|
125
|
+
this._events[type] ??= new Set();
|
|
126
|
+
this._events[type].add(newListener);
|
|
127
|
+
|
|
128
|
+
if (contexts) {
|
|
129
|
+
contexts.set(context, newListener);
|
|
130
|
+
} else {
|
|
131
|
+
this._listenerIndex[type].set(fn, new Map([[context, newListener]]));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Listeners of the given event type, indexed by function and context, so that
|
|
136
|
+
// adding and removing listeners doesn't need to scan all listeners of the type
|
|
137
|
+
// (e.g. each marker listens to the map's `zoom` events with the same function).
|
|
138
|
+
_getListenerIndex(type) {
|
|
139
|
+
this._listenerIndex ??= {};
|
|
140
|
+
return (this._listenerIndex[type] ??= new Map());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_off(type, fn, context) {
|
|
144
|
+
if (!this._events) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let listeners = this._events[type];
|
|
149
|
+
if (!listeners) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (arguments.length === 1) { // remove all
|
|
154
|
+
if (this._firingCount) {
|
|
155
|
+
// Set all removed listeners to noop
|
|
156
|
+
// so they are not called if remove happens in fire
|
|
157
|
+
for (const listener of listeners) {
|
|
158
|
+
listener.fn = Util.falseFn;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// clear all listeners for a type if function isn't specified
|
|
162
|
+
delete this._events[type];
|
|
163
|
+
delete this._listenerIndex?.[type];
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (typeof fn !== 'function') {
|
|
168
|
+
console.warn(`wrong listener type: ${typeof fn}`);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// find fn and remove it
|
|
173
|
+
if (context === this) {
|
|
174
|
+
context = undefined;
|
|
175
|
+
}
|
|
176
|
+
const contexts = this._listenerIndex?.[type]?.get(fn),
|
|
177
|
+
listener = contexts?.get(context);
|
|
178
|
+
if (listener) {
|
|
179
|
+
contexts.delete(context);
|
|
180
|
+
if (!contexts.size) {
|
|
181
|
+
this._listenerIndex[type].delete(fn);
|
|
182
|
+
}
|
|
183
|
+
if (this._firingCount) {
|
|
184
|
+
// set the removed listener to noop so that's not called if remove happens in fire
|
|
185
|
+
listener.fn = Util.falseFn;
|
|
186
|
+
|
|
187
|
+
/* copy listeners in case events are being fired */
|
|
188
|
+
this._events[type] = listeners = new Set(listeners);
|
|
189
|
+
}
|
|
190
|
+
listeners.delete(listener);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// @method fire(type: String, data?: Object, propagate?: Boolean): this
|
|
195
|
+
// Fires an event of the specified type. You can optionally provide a data
|
|
196
|
+
// object — the first argument of the listener function will contain its
|
|
197
|
+
// properties. The event can optionally be propagated to event parents.
|
|
198
|
+
fire(type, data, propagate) {
|
|
199
|
+
if (!this.listens(type, propagate)) { return this; }
|
|
200
|
+
|
|
201
|
+
const event = {
|
|
202
|
+
...data,
|
|
203
|
+
type,
|
|
204
|
+
target: this,
|
|
205
|
+
sourceTarget: data?.sourceTarget || this
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
if (this._events) {
|
|
209
|
+
const listeners = this._events[type];
|
|
210
|
+
if (listeners) {
|
|
211
|
+
this._firingCount = (this._firingCount + 1) || 1;
|
|
212
|
+
for (const l of listeners) {
|
|
213
|
+
// off overwrites l.fn, so we need to copy fn to a variable
|
|
214
|
+
const fn = l.fn;
|
|
215
|
+
if (l.once) {
|
|
216
|
+
this.off(type, fn, l.ctx);
|
|
217
|
+
}
|
|
218
|
+
fn.call(l.ctx || this, event);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
this._firingCount--;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (propagate) {
|
|
226
|
+
// propagate the event to parents (set with addEventParent)
|
|
227
|
+
this._propagateEvent(event);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// @method listens(type: String, propagate?: Boolean): Boolean
|
|
234
|
+
// @method listens(type: String, fn: Function, context?: Object, propagate?: Boolean): Boolean
|
|
235
|
+
// Returns `true` if a particular event type has any listeners attached to it.
|
|
236
|
+
// The verification can optionally be propagated, it will return `true` if parents have the listener attached to it.
|
|
237
|
+
listens(type, fn, context, propagate) {
|
|
238
|
+
if (typeof type !== 'string') {
|
|
239
|
+
console.warn('"string" type argument expected');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// we don't overwrite the input `fn` value, because we need to use it for propagation
|
|
243
|
+
let _fn = fn;
|
|
244
|
+
if (typeof fn !== 'function') {
|
|
245
|
+
propagate = !!fn;
|
|
246
|
+
_fn = undefined;
|
|
247
|
+
context = undefined;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this._events?.[type]?.size) {
|
|
251
|
+
if (this._listens(type, _fn, context) !== false) {
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (propagate) {
|
|
257
|
+
// also check parents for listeners if event propagates
|
|
258
|
+
for (const p of Object.values(this._eventParents ?? {})) {
|
|
259
|
+
if (p.listens(type, fn, context, propagate)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// returns whether the given listener (or any listener, if no `fn` is given) is registered
|
|
268
|
+
_listens(type, fn, context) {
|
|
269
|
+
if (!this._events) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const listeners = this._events[type];
|
|
274
|
+
if (!fn) {
|
|
275
|
+
return !!listeners?.size;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (context === this) {
|
|
279
|
+
// Less memory footprint.
|
|
280
|
+
context = undefined;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return !!this._listenerIndex?.[type]?.get(fn)?.has(context);
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// @method once(…): this
|
|
288
|
+
// Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.
|
|
289
|
+
once(types, fn, context) {
|
|
290
|
+
|
|
291
|
+
// types can be a map of types/handlers
|
|
292
|
+
if (typeof types === 'object') {
|
|
293
|
+
for (const [type, f] of Object.entries(types)) {
|
|
294
|
+
// we don't process space-separated events here for performance;
|
|
295
|
+
// it's a hot path since Layer uses the on(obj) syntax
|
|
296
|
+
this._on(type, f, fn, true);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
} else {
|
|
300
|
+
// types can be a string of space-separated words
|
|
301
|
+
for (const type of Util.splitWords(types)) {
|
|
302
|
+
this._on(type, fn, context, true);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return this;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// @method addEventParent(obj: Evented): this
|
|
310
|
+
// Adds an event parent - an `Evented` that will receive propagated events
|
|
311
|
+
addEventParent(obj) {
|
|
312
|
+
this._eventParents ??= {};
|
|
313
|
+
this._eventParents[Util.stamp(obj)] = obj;
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// @method removeEventParent(obj: Evented): this
|
|
318
|
+
// Removes an event parent, so it will stop receiving propagated events
|
|
319
|
+
removeEventParent(obj) {
|
|
320
|
+
if (this._eventParents) {
|
|
321
|
+
delete this._eventParents[Util.stamp(obj)];
|
|
322
|
+
}
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
_propagateEvent(e) {
|
|
327
|
+
for (const p of Object.values(this._eventParents ?? {})) {
|
|
328
|
+
p.fire(e.type, {
|
|
329
|
+
propagatedFrom: e.target,
|
|
330
|
+
...e
|
|
331
|
+
}, true);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
};
|