mobility-toolbox-js 3.0.0-beta.27 → 3.0.0-beta.28

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 CHANGED
@@ -52437,7 +52437,9 @@ uniform ${i3} ${a3} u_${s3};
52437
52437
  ...options.mapLibreOptions || {}
52438
52438
  }
52439
52439
  };
52440
- if (!newOptions.mapLibreOptions.style && newOptions.apiKey && newOptions.style && typeof newOptions.style === "string") {
52440
+ if (!newOptions.mapLibreOptions.style && newOptions.url?.includes("style.json")) {
52441
+ newOptions.mapLibreOptions.style = newOptions.url;
52442
+ } else if (!newOptions.mapLibreOptions.style && newOptions.apiKey && newOptions.style && typeof newOptions.style === "string") {
52441
52443
  newOptions.mapLibreOptions.style = buildStyleUrl(
52442
52444
  newOptions.url,
52443
52445
  newOptions.style,
@@ -52771,6 +52773,16 @@ uniform ${i3} ${a3} u_${s3};
52771
52773
  this.detachFromMap();
52772
52774
  this.attachToMap(map);
52773
52775
  }
52776
+ }),
52777
+ // When the style changes we wait that it is loaded to relaunch the onLoad
52778
+ this.maplibreLayer.on("propertychange", (evt) => {
52779
+ if (evt.key === "style") {
52780
+ evt.target.maplibreMap.once("styledata", () => {
52781
+ evt.target.maplibreMap.once("idle", () => {
52782
+ this.onLoad();
52783
+ });
52784
+ });
52785
+ }
52774
52786
  })
52775
52787
  );
52776
52788
  }