mobility-toolbox-js 2.0.1-beta.13 → 2.2.0-beta.0
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/api/RealtimeAPI.d.ts +281 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +490 -0
- package/api/RoutingAPI.d.ts +37 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/RoutingAPI.js +32 -12
- package/api/StopsAPI.d.ts +38 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +33 -9
- package/api/index.d.ts +4 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +3 -3
- package/api/typedefs.d.ts +179 -0
- package/api/typedefs.d.ts.map +1 -0
- package/api/typedefs.js +75 -0
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +54 -27
- package/common/api/WebSocketAPI.d.ts +153 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +330 -164
- package/common/controls/ControlCommon.d.ts +76 -0
- package/common/controls/ControlCommon.d.ts.map +1 -0
- package/common/controls/ControlCommon.js +150 -0
- package/common/controls/CopyrightControlCommon.d.ts +13 -0
- package/common/controls/CopyrightControlCommon.d.ts.map +1 -0
- package/common/controls/CopyrightControlCommon.js +34 -0
- package/common/controls/StopFinderControlCommon.d.ts +55 -0
- package/common/controls/StopFinderControlCommon.d.ts.map +1 -0
- package/common/controls/StopFinderControlCommon.js +144 -0
- package/common/index.d.ts +3 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +2 -4
- package/common/layers/LayerCommon.d.ts +94 -0
- package/common/layers/LayerCommon.d.ts.map +1 -0
- package/common/layers/LayerCommon.js +244 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +286 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.js +779 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts +60 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
- package/common/mixins/UserInteractionsLayerMixin.js +241 -0
- package/common/styles/index.d.ts +5 -0
- package/common/styles/index.d.ts.map +1 -0
- package/common/styles/index.js +4 -4
- package/common/styles/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.js +275 -0
- package/common/styles/realtimeDelayStyle.d.ts +12 -0
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
- package/common/styles/realtimeDelayStyle.js +13 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts.map +1 -0
- package/common/styles/realtimeHeadingStyle.js +85 -0
- package/common/styles/realtimeSimpleStyle.d.ts +4 -0
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
- package/common/styles/realtimeSimpleStyle.js +23 -0
- package/common/typedefs.d.ts +111 -0
- package/common/typedefs.d.ts.map +1 -0
- package/common/typedefs.js +52 -0
- package/common/utils/compareDepartures.d.ts +11 -0
- package/common/utils/compareDepartures.d.ts.map +1 -0
- package/common/utils/compareDepartures.js +35 -0
- package/common/utils/createCanvas.d.ts +10 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createCanvas.js +27 -0
- package/common/utils/createRealtimeFilters.d.ts +13 -0
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/createRealtimeFilters.js +74 -0
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +24 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +29 -0
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.js +15 -0
- package/common/utils/getMapboxMapCopyrights.d.ts +18 -0
- package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
- package/common/utils/getMapboxMapCopyrights.js +26 -15
- package/common/utils/getMapboxRender.d.ts +7 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMapboxRender.js +87 -0
- package/common/utils/getMaplibreRender.d.ts +7 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.js +38 -0
- package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
- package/common/utils/getRealtimeModeSuffix.js +7 -0
- package/common/utils/getUrlWithParams.d.ts +9 -0
- package/common/utils/getUrlWithParams.d.ts.map +1 -0
- package/common/utils/getUrlWithParams.js +18 -0
- package/common/utils/getVehiclePosition.d.ts +16 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -0
- package/common/utils/getVehiclePosition.js +67 -37
- package/common/utils/index.d.ts +17 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +17 -5
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/realtimeConfig.js +173 -0
- package/common/utils/removeDuplicate.d.ts +10 -0
- package/common/utils/removeDuplicate.d.ts.map +1 -0
- package/common/utils/removeDuplicate.js +12 -5
- package/common/utils/renderTrajectories.d.ts +17 -0
- package/common/utils/renderTrajectories.d.ts.map +1 -0
- package/common/utils/renderTrajectories.js +110 -0
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
- package/common/utils/sortAndFilterDepartures.js +58 -0
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/sortByDelay.js +17 -15
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +34 -15
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/iife.js +5 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +8 -6
- package/mapbox/controls/CopyrightControl.d.ts +29 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +44 -25
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/controls/index.js +2 -1
- package/mapbox/index.d.ts +6 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/index.js +5 -4
- package/mapbox/layers/Layer.d.ts +59 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +99 -55
- package/mapbox/layers/RealtimeLayer.d.ts +181 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.js +276 -0
- package/mapbox/layers/index.d.ts +3 -0
- package/mapbox/layers/index.d.ts.map +1 -0
- package/mapbox/layers/index.js +2 -2
- package/mapbox/utils/getMercatorResolution.d.ts +9 -0
- package/mapbox/utils/getMercatorResolution.d.ts.map +1 -0
- package/mapbox/utils/getMercatorResolution.js +18 -0
- package/mapbox/utils/getSourceCoordinates.d.ts +9 -0
- package/mapbox/utils/getSourceCoordinates.d.ts.map +1 -0
- package/mapbox/utils/getSourceCoordinates.js +27 -0
- package/mapbox/utils/index.d.ts +3 -0
- package/mapbox/utils/index.d.ts.map +1 -0
- package/mapbox/utils/index.js +2 -0
- package/mbt.js +26074 -16501
- package/mbt.js.map +4 -4
- package/mbt.min.js +205 -126
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +62 -36
- package/ol/controls/RoutingControl.d.ts +193 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +601 -357
- package/ol/controls/StopFinderControl.d.ts +30 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.js +30 -8
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/controls/index.js +3 -3
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/index.js +5 -5
- package/ol/layers/Layer.d.ts +86 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +163 -77
- package/ol/layers/MapGlLayer.d.ts +67 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -0
- package/ol/layers/MapGlLayer.js +218 -0
- package/ol/layers/MapboxLayer.d.ts +50 -0
- package/ol/layers/MapboxLayer.d.ts.map +1 -0
- package/ol/layers/MapboxLayer.js +99 -193
- package/ol/layers/MapboxStyleLayer.d.ts +129 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +362 -171
- package/ol/layers/MaplibreLayer.d.ts +28 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +30 -135
- package/ol/layers/RealtimeLayer.d.ts +202 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -0
- package/ol/layers/RealtimeLayer.js +340 -0
- package/ol/layers/RoutingLayer.d.ts +34 -0
- package/ol/layers/RoutingLayer.d.ts.map +1 -0
- package/ol/layers/RoutingLayer.js +72 -48
- package/ol/layers/VectorLayer.d.ts +25 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +34 -18
- package/ol/layers/WMSLayer.d.ts +42 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +84 -34
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/layers/index.js +8 -8
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +26 -24
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +40 -39
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/ol/styles/index.js +2 -2
- package/package.json +81 -133
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/setupTests.js +26 -0
- package/types/common.d.ts +122 -0
- package/types/index.d.ts +13 -0
- package/types/realtime.d.ts +320 -0
- package/types/routing.d.ts +206 -0
- package/types/stops.d.ts +143 -0
- package/README.md +0 -23
- package/api/RoutingAPI.test.js +0 -25
- package/api/StopsAPI.test.js +0 -22
- package/api/TralisAPI.js +0 -359
- package/api/TralisAPI.test.js +0 -67
- package/api/TralisAPIUtils.js +0 -43
- package/common/Tracker.js +0 -93
- package/common/api/HttpAPI.test.js +0 -50
- package/common/api/WebSocketAPI.test.js +0 -311
- package/common/controls/Control.js +0 -81
- package/common/controls/Control.test.js +0 -87
- package/common/layers/Layer.js +0 -213
- package/common/layers/Layer.test.js +0 -526
- package/common/mixins/CopyrightMixin.js +0 -24
- package/common/mixins/SearchMixin.js +0 -110
- package/common/mixins/TralisLayerMixin.js +0 -479
- package/common/styles/trackerDefaultStyle.js +0 -197
- package/common/styles/trackerDelayStyle.js +0 -8
- package/common/styles/trackerSimpleStyle.js +0 -18
- package/common/trackerConfig.js +0 -152
- package/common/trackerConfig.test.js +0 -23
- package/common/utils/createTrackerFilters.js +0 -56
- package/common/utils/createTrackerFilters.test.js +0 -79
- package/common/utils/getMapboxMapCopyrights.test.js +0 -40
- package/common/utils/getMapboxStyleUrl.js +0 -22
- package/common/utils/removeDuplicate.test.js +0 -19
- package/common/utils/timeUtils.test.js +0 -10
- package/mapbox/layers/Layer.test.js +0 -182
- package/mapbox/layers/TralisLayer.js +0 -182
- package/mapbox/layers/TralisLayer.test.js +0 -38
- package/mapbox/utils.js +0 -32
- package/ol/controls/CopyrightControl.test.js +0 -165
- package/ol/controls/RoutingControl.test.js +0 -151
- package/ol/controls/StopFinderControl.test.js +0 -48
- package/ol/layers/Layer.test.js +0 -174
- package/ol/layers/MapboxLayer.test.js +0 -160
- package/ol/layers/MapboxStyleLayer.test.js +0 -231
- package/ol/layers/RoutingLayer.test.js +0 -40
- package/ol/layers/TralisLayer.js +0 -185
- package/ol/layers/TralisLayer.test.js +0 -79
- package/ol/layers/VectorLayer.test.js +0 -87
- package/ol/layers/WMSLayer.test.js +0 -76
package/common/layers/Layer.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import Observable from "ol/Observable";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
export default class Layer extends Observable {
|
|
4
|
-
constructor(options = {}) {
|
|
5
|
-
super();
|
|
6
|
-
this.defineProperties(options);
|
|
7
|
-
const { onClick, onHover } = options;
|
|
8
|
-
if (onHover) {
|
|
9
|
-
this.onHover(onHover);
|
|
10
|
-
}
|
|
11
|
-
if (onClick) {
|
|
12
|
-
this.onClick(onClick);
|
|
13
|
-
}
|
|
14
|
-
if (options.copyrights) {
|
|
15
|
-
this.copyrights = options.copyrights;
|
|
16
|
-
}
|
|
17
|
-
this.onUserClickCallback = this.onUserClickCallback.bind(this);
|
|
18
|
-
this.onUserMoveCallback = this.onUserMoveCallback.bind(this);
|
|
19
|
-
}
|
|
20
|
-
defineProperties(options) {
|
|
21
|
-
const {
|
|
22
|
-
name,
|
|
23
|
-
key,
|
|
24
|
-
children,
|
|
25
|
-
visible,
|
|
26
|
-
properties,
|
|
27
|
-
isBaseLayer,
|
|
28
|
-
isQueryable,
|
|
29
|
-
isClickActive,
|
|
30
|
-
isHoverActive,
|
|
31
|
-
hitTolerance
|
|
32
|
-
} = {
|
|
33
|
-
isQueryable: true,
|
|
34
|
-
isClickActive: true,
|
|
35
|
-
isHoverActive: true,
|
|
36
|
-
...options
|
|
37
|
-
};
|
|
38
|
-
const uid = uuid();
|
|
39
|
-
const dfltName = name || uid;
|
|
40
|
-
Object.defineProperties(this, {
|
|
41
|
-
options: {
|
|
42
|
-
value: options
|
|
43
|
-
},
|
|
44
|
-
name: {
|
|
45
|
-
value: dfltName
|
|
46
|
-
},
|
|
47
|
-
key: {
|
|
48
|
-
value: key || dfltName.toLowerCase()
|
|
49
|
-
},
|
|
50
|
-
isBaseLayer: {
|
|
51
|
-
value: !!isBaseLayer
|
|
52
|
-
},
|
|
53
|
-
isQueryable: {
|
|
54
|
-
value: !!isQueryable,
|
|
55
|
-
writable: true
|
|
56
|
-
},
|
|
57
|
-
isClickActive: {
|
|
58
|
-
value: !!isQueryable && !!isClickActive,
|
|
59
|
-
writable: true
|
|
60
|
-
},
|
|
61
|
-
isHoverActive: {
|
|
62
|
-
value: !!isQueryable && !!isHoverActive,
|
|
63
|
-
writable: true
|
|
64
|
-
},
|
|
65
|
-
hitTolerance: {
|
|
66
|
-
value: hitTolerance || 5,
|
|
67
|
-
writable: true
|
|
68
|
-
},
|
|
69
|
-
isMobilityLayer: {
|
|
70
|
-
value: true
|
|
71
|
-
},
|
|
72
|
-
children: {
|
|
73
|
-
value: children || [],
|
|
74
|
-
writable: true
|
|
75
|
-
},
|
|
76
|
-
copyrights: {
|
|
77
|
-
get: () => this.get("copyrights"),
|
|
78
|
-
set: (newCopyrights) => {
|
|
79
|
-
const arrValue = !Array.isArray(newCopyrights) ? [newCopyrights] : newCopyrights;
|
|
80
|
-
this.set("copyrights", arrValue);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
visible: {
|
|
84
|
-
value: visible === void 0 ? true : visible,
|
|
85
|
-
writable: true
|
|
86
|
-
},
|
|
87
|
-
properties: {
|
|
88
|
-
value: { ...properties || {} }
|
|
89
|
-
},
|
|
90
|
-
map: {
|
|
91
|
-
writable: true
|
|
92
|
-
},
|
|
93
|
-
clickCallbacks: {
|
|
94
|
-
value: []
|
|
95
|
-
},
|
|
96
|
-
hoverCallbacks: {
|
|
97
|
-
value: []
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
attachToMap(map) {
|
|
102
|
-
this.detachFromMap();
|
|
103
|
-
this.map = map;
|
|
104
|
-
}
|
|
105
|
-
detachFromMap() {
|
|
106
|
-
}
|
|
107
|
-
get(name) {
|
|
108
|
-
return this.properties[name];
|
|
109
|
-
}
|
|
110
|
-
set(name, value) {
|
|
111
|
-
if (value !== this.properties[name]) {
|
|
112
|
-
this.properties[name] = value;
|
|
113
|
-
this.dispatchEvent({
|
|
114
|
-
type: `change:${name}`,
|
|
115
|
-
target: this
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
setVisible(visible, stopPropagationDown = false, stopPropagationUp = false, stopPropagationSiblings = false) {
|
|
120
|
-
if (visible === this.visible) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this.visible = visible;
|
|
124
|
-
this.dispatchEvent({
|
|
125
|
-
type: "change:visible",
|
|
126
|
-
target: this,
|
|
127
|
-
stopPropagationDown,
|
|
128
|
-
stopPropagationUp,
|
|
129
|
-
stopPropagationSiblings
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
getVisibleChildren() {
|
|
133
|
-
return this.children.filter((child) => child.visible);
|
|
134
|
-
}
|
|
135
|
-
hasVisibleChildren() {
|
|
136
|
-
return !!this.children.find((child) => child.visible === true);
|
|
137
|
-
}
|
|
138
|
-
getFeatureInfoAtCoordinate(coordinate, options) {
|
|
139
|
-
console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers", this.key);
|
|
140
|
-
this.isQueryable = false;
|
|
141
|
-
return Promise.resolve({
|
|
142
|
-
layer: this,
|
|
143
|
-
features: [],
|
|
144
|
-
coordinate
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
onClick(callback) {
|
|
148
|
-
if (typeof callback === "function") {
|
|
149
|
-
if (!this.clickCallbacks.includes(callback)) {
|
|
150
|
-
this.clickCallbacks.push(callback);
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
throw new Error("onClick callback must be of type function:", callback);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
unClick(callback) {
|
|
157
|
-
if (typeof callback === "function") {
|
|
158
|
-
const idx = this.clickCallbacks.indexOf(callback);
|
|
159
|
-
if (idx > -1) {
|
|
160
|
-
this.clickCallbacks.splice(idx, 1);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
onUserClickCallback(evt) {
|
|
165
|
-
const emptyFeatureInfo = {
|
|
166
|
-
features: [],
|
|
167
|
-
layer: this,
|
|
168
|
-
coordinate: evt.coordinate,
|
|
169
|
-
event: evt
|
|
170
|
-
};
|
|
171
|
-
if (!this.isClickActive || !this.clickCallbacks.length) {
|
|
172
|
-
return Promise.resolve(emptyFeatureInfo);
|
|
173
|
-
}
|
|
174
|
-
return this.getFeatureInfoAtCoordinate(evt.coordinate).then((featureInfo) => {
|
|
175
|
-
const { features, layer, coordinate } = featureInfo;
|
|
176
|
-
this.clickCallbacks.forEach((callback) => callback(features, layer, coordinate));
|
|
177
|
-
return featureInfo;
|
|
178
|
-
}).catch(() => emptyFeatureInfo);
|
|
179
|
-
}
|
|
180
|
-
onHover(callback) {
|
|
181
|
-
if (typeof callback === "function") {
|
|
182
|
-
if (!this.hoverCallbacks.includes(callback)) {
|
|
183
|
-
this.hoverCallbacks.push(callback);
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
throw new Error("callback must be of type function.");
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
unHover(callback) {
|
|
190
|
-
if (typeof callback === "function") {
|
|
191
|
-
const idx = this.hoverCallbacks.indexOf(callback);
|
|
192
|
-
if (idx > -1) {
|
|
193
|
-
this.hoverCallbacks.splice(idx, 1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
onUserMoveCallback(evt) {
|
|
198
|
-
const emptyFeatureInfo = {
|
|
199
|
-
features: [],
|
|
200
|
-
layer: this,
|
|
201
|
-
coordinate: evt.coordinate,
|
|
202
|
-
event: evt
|
|
203
|
-
};
|
|
204
|
-
if (!this.isHoverActive || !this.hoverCallbacks.length) {
|
|
205
|
-
return Promise.resolve(emptyFeatureInfo);
|
|
206
|
-
}
|
|
207
|
-
return this.getFeatureInfoAtCoordinate(evt.coordinate).then((featureInfo) => {
|
|
208
|
-
const { features, layer, coordinate } = featureInfo;
|
|
209
|
-
this.hoverCallbacks.forEach((callback) => callback(features, layer, coordinate));
|
|
210
|
-
return featureInfo;
|
|
211
|
-
}).catch(() => emptyFeatureInfo);
|
|
212
|
-
}
|
|
213
|
-
}
|