mobility-toolbox-js 2.0.0-beta.39 → 2.0.0-beta.40
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/common/mixins/UserInteractionsLayerMixin.d.ts +11 -3
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -1
- package/common/mixins/UserInteractionsLayerMixin.js +44 -3
- package/mbt.js +23 -0
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +3 -0
- package/package.json +1 -1
|
@@ -18,17 +18,25 @@ export class UserInteractionsLayerInterface {
|
|
|
18
18
|
*/
|
|
19
19
|
activateUserInteractions(): void;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Deactivate map listeners events.
|
|
22
22
|
*/
|
|
23
23
|
deactivateUserInteractions(): void;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Subscribe on user:click event.
|
|
26
26
|
*/
|
|
27
27
|
onClick(callback: any): void;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Subscribe on user:hover event.
|
|
30
30
|
*/
|
|
31
31
|
onHover(callback: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Unsubscribe on user:click event.
|
|
34
|
+
*/
|
|
35
|
+
unClick(callback: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Unsubscribe on user:hover event.
|
|
38
|
+
*/
|
|
39
|
+
unHover(callback: any): void;
|
|
32
40
|
}
|
|
33
41
|
export default UserInteractionsLayerMixin;
|
|
34
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserInteractionsLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/UserInteractionsLayerMixin.js"],"names":[],"mappings":"AAQA;;GAEG;AACH;IAUE,0BAA4B;IAE5B;;;;OAIG;IACH,4BAAmB;IAEnB;;OAEG;IACH,sBAAkB;IAElB;;OAEG;IACH,iCAA6B;IAE7B;;OAEG;IACH,mCAA+B;IAE/B;;OAEG;IACH,6BAAoB;IAEpB;;OAEG;IACH,6BAAoB;CACrB;;AAED;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"UserInteractionsLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/UserInteractionsLayerMixin.js"],"names":[],"mappings":"AAQA;;GAEG;AACH;IAUE,0BAA4B;IAE5B;;;;OAIG;IACH,4BAAmB;IAEnB;;OAEG;IACH,sBAAkB;IAElB;;OAEG;IACH,iCAA6B;IAE7B;;OAEG;IACH,mCAA+B;IAE/B;;OAEG;IACH,6BAAoB;IAEpB;;OAEG;IACH,6BAAoB;IAEpB;;OAEG;IACH,6BAAoB;IAEpB;;OAEG;IACH,6BAAoB;CACrB;;AAED;;;;;;GAMG;AACH,gEAkNG"}
|
|
@@ -34,17 +34,25 @@ export class UserInteractionsLayerInterface {
|
|
|
34
34
|
*/
|
|
35
35
|
activateUserInteractions() { }
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Deactivate map listeners events.
|
|
38
38
|
*/
|
|
39
39
|
deactivateUserInteractions() { }
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Subscribe on user:click event.
|
|
42
42
|
*/
|
|
43
43
|
onClick(callback) { }
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Subscribe on user:hover event.
|
|
46
46
|
*/
|
|
47
47
|
onHover(callback) { }
|
|
48
|
+
/**
|
|
49
|
+
* Unsubscribe on user:click event.
|
|
50
|
+
*/
|
|
51
|
+
unClick(callback) { }
|
|
52
|
+
/**
|
|
53
|
+
* Unsubscribe on user:hover event.
|
|
54
|
+
*/
|
|
55
|
+
unHover(callback) { }
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* Mixin for UserInteractionsLayerInterface. It provide onClick and onHover functions.
|
|
@@ -142,6 +150,39 @@ const UserInteractionsLayerMixin = (Base) => class extends Base {
|
|
|
142
150
|
this.listenEvents();
|
|
143
151
|
}
|
|
144
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Unlistens to click events on the layer.
|
|
155
|
+
* @param {function} callback Callback function, called with the clicked
|
|
156
|
+
* features,
|
|
157
|
+
* the layer instance and the click event.
|
|
158
|
+
*/
|
|
159
|
+
unClick(callback) {
|
|
160
|
+
const index = this.userClickCallbacks.indexOf(callback);
|
|
161
|
+
if (index !== -1) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.userClickCallbacks = this.userClickCallbacks.slice(index, 1);
|
|
165
|
+
if (this.map) {
|
|
166
|
+
// If the layer is already attached to the map we reload the events
|
|
167
|
+
this.listenEvents();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Unlistens to hover events on the layer.
|
|
172
|
+
* @param {function} callback Callback function, called with the clicked
|
|
173
|
+
* features, the layer instance and the click event.
|
|
174
|
+
*/
|
|
175
|
+
unHover(callback) {
|
|
176
|
+
const index = this.userHoverCallbacks.indexOf(callback);
|
|
177
|
+
if (index !== -1) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.userHoverCallbacks = this.userHoverCallbacks.slice(index, 1);
|
|
181
|
+
if (this.map) {
|
|
182
|
+
// If the layer is already attached to the map we reload the events
|
|
183
|
+
this.listenEvents();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
145
186
|
/**
|
|
146
187
|
* Function triggered when the user click the map.
|
|
147
188
|
* @private
|
package/mbt.js
CHANGED
|
@@ -48002,6 +48002,26 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48002
48002
|
this.listenEvents();
|
|
48003
48003
|
}
|
|
48004
48004
|
}
|
|
48005
|
+
unClick(callback) {
|
|
48006
|
+
const index = this.userClickCallbacks.indexOf(callback);
|
|
48007
|
+
if (index !== -1) {
|
|
48008
|
+
return;
|
|
48009
|
+
}
|
|
48010
|
+
this.userClickCallbacks = this.userClickCallbacks.slice(index, 1);
|
|
48011
|
+
if (this.map) {
|
|
48012
|
+
this.listenEvents();
|
|
48013
|
+
}
|
|
48014
|
+
}
|
|
48015
|
+
unHover(callback) {
|
|
48016
|
+
const index = this.userHoverCallbacks.indexOf(callback);
|
|
48017
|
+
if (index !== -1) {
|
|
48018
|
+
return;
|
|
48019
|
+
}
|
|
48020
|
+
this.userHoverCallbacks = this.userHoverCallbacks.slice(index, 1);
|
|
48021
|
+
if (this.map) {
|
|
48022
|
+
this.listenEvents();
|
|
48023
|
+
}
|
|
48024
|
+
}
|
|
48005
48025
|
onUserClickCallback(evt) {
|
|
48006
48026
|
const coordinate = evt.coordinate || fromLonLat(evt.lngLat.toArray());
|
|
48007
48027
|
const emptyFeatureInfo = {
|
|
@@ -49628,6 +49648,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49628
49648
|
return false;
|
|
49629
49649
|
}
|
|
49630
49650
|
renderTrajectories(noInterpolate) {
|
|
49651
|
+
if (!this.map) {
|
|
49652
|
+
return;
|
|
49653
|
+
}
|
|
49631
49654
|
const view = this.map.getView();
|
|
49632
49655
|
super.renderTrajectories({
|
|
49633
49656
|
size: this.map.getSize(),
|