mobility-toolbox-js 3.0.1-beta.5 → 3.0.1-beta.7

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.
@@ -86,6 +86,7 @@ declare class MaplibreLayer extends MapLibreLayer {
86
86
  clone(newOptions: MaplibreLayerOptions): MaplibreLayer;
87
87
  createRenderer(): MaplibreLayerRenderer;
88
88
  detachFromMap(): void;
89
+ disposeInternal(): void;
89
90
  getStyle(): any;
90
91
  setMapInternal(map: Map): void;
91
92
  updateMaplibreMap(): void;
@@ -153,6 +153,12 @@ class MaplibreLayer extends MapLibreLayer {
153
153
  detachFromMap() {
154
154
  unByKey(this.olEventsKeys);
155
155
  }
156
+ disposeInternal() {
157
+ const source = this.getSource();
158
+ super.disposeInternal();
159
+ // We don't want the source removed
160
+ this.setSource(source);
161
+ }
156
162
  getStyle() {
157
163
  var _a, _b;
158
164
  // If the style is a complete style object, use it directly.
@@ -226,21 +226,10 @@ class MaplibreStyleLayer extends Layer {
226
226
  * @override
227
227
  */
228
228
  attachToMap(map) {
229
- if (this.maplibreLayer && !this.maplibreLayer.getMapInternal()) {
230
- map.addLayer(this.maplibreLayer);
231
- }
232
229
  const mapInternal = this.getMapInternal();
233
230
  if (!mapInternal || !this.maplibreLayer) {
234
231
  return;
235
232
  }
236
- if (!mapInternal.getTargetElement()) {
237
- // If ther e is no target element the mapLibreMap is not yet created, we
238
- // relaunch the initialisation when it's the case.
239
- this.olEventsKeys.push(mapInternal.on('change:target', () => {
240
- this.attachToMap(map);
241
- }));
242
- return;
243
- }
244
233
  // Apply the initial visibility if possible otherwise we wait for the load event of the layer
245
234
  const { mapLibreMap } = this.maplibreLayer;
246
235
  if (mapLibreMap) {
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",
5
+ "version": "3.0.1-beta.7",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",