mobility-toolbox-js 2.0.0-beta.37 → 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 +4696 -4143
- package/mbt.js.map +3 -3
- package/mbt.min.js +193 -118
- package/mbt.min.js.map +3 -3
- package/ol/layers/MapboxLayer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.js +4 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +3 -0
- package/package.json +9 -15
|
@@ -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
|