mobility-toolbox-js 3.0.1-beta.2 → 3.0.1-beta.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/mbt.js +10 -6
- package/mbt.js.map +3 -3
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +3 -3
- package/ol/layers/RealtimeLayer.js +4 -0
- package/ol/renderers/MaplibreLayerRenderer.js +9 -7
- package/package.json +1 -1
|
@@ -112,6 +112,7 @@ class RealtimeLayer extends Layer {
|
|
|
112
112
|
this.onMoveEndDebounced = debounce(this.onMoveEnd, 100);
|
|
113
113
|
}
|
|
114
114
|
attachToMap() {
|
|
115
|
+
var _a;
|
|
115
116
|
this.engine.attachToMap();
|
|
116
117
|
const mapInternal = this.getMapInternal();
|
|
117
118
|
if (mapInternal) {
|
|
@@ -120,6 +121,9 @@ class RealtimeLayer extends Layer {
|
|
|
120
121
|
this.engine.start();
|
|
121
122
|
}
|
|
122
123
|
const index = mapInternal.getLayers().getArray().indexOf(this);
|
|
124
|
+
if (this.vectorLayer.getMapInternal() === mapInternal) {
|
|
125
|
+
(_a = this.getMapInternal()) === null || _a === void 0 ? void 0 : _a.removeLayer(this.vectorLayer);
|
|
126
|
+
}
|
|
123
127
|
mapInternal.getLayers().insertAt(index, this.vectorLayer);
|
|
124
128
|
this.olEventsKeys.push(...mapInternal.on(['moveend', 'change:target'],
|
|
125
129
|
// @ts-expect-error - bad ol definitions
|
|
@@ -13,16 +13,18 @@ export default class MaplibreLayerRenderer extends MapLibreLayerRenderer {
|
|
|
13
13
|
this.ignoreNextRender = false;
|
|
14
14
|
}
|
|
15
15
|
renderFrame(frameState) {
|
|
16
|
-
var _a, _b
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const layer = this.getLayer();
|
|
18
|
+
const { mapLibreMap } = layer;
|
|
19
|
+
const map = layer.getMapInternal();
|
|
17
20
|
(_b = (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.mapLibreMap) === null || _b === void 0 ? void 0 : _b.off('idle', this.setIsReady);
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
if (!layer || !map || !mapLibreMap) {
|
|
22
|
+
// @ts-expect-error - can return null
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
20
25
|
if (this.ignoreNextRender) {
|
|
21
26
|
this.ignoreNextRender = false;
|
|
22
|
-
|
|
23
|
-
if (container) {
|
|
24
|
-
return container;
|
|
25
|
-
}
|
|
27
|
+
return mapLibreMap === null || mapLibreMap === void 0 ? void 0 : mapLibreMap.getContainer();
|
|
26
28
|
}
|
|
27
29
|
this.ready = false;
|
|
28
30
|
const container = super.renderFrame(frameState);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mobility-toolbox-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
|
|
5
|
-
"version": "3.0.1-beta.
|
|
5
|
+
"version": "3.0.1-beta.4",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|