Skip to content

Commit

Permalink
fix: fix switch style
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed Nov 19, 2024
1 parent 09edb09 commit 9039cc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ mkdirp@^0.5.1:
minimist "^1.2.6"

mobility-toolbox-js@./../build:
version "3.0.0-beta.35"
version "3.0.0-beta.36"
dependencies:
"@geoblocks/ol-maplibre-layer" "^1.0.1"
"@turf/helpers" "7.1.0"
Expand Down
10 changes: 7 additions & 3 deletions src/ol/layers/MaplibreLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
);
}
super(newOptions);

// We save the options to be able to clone the layer.
// and to see if the style is defined by the maplibreOptions given by the user.
this.set('options', options);
}

/**
Expand Down Expand Up @@ -181,9 +185,9 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
return this.url;
}

// If the style is defined by the maplibreOptions, we use it directly
if (this.get('mapLibreOptions')?.style) {
return this.get('mapLibreOptions').style;
// If the user has defined the style by the maplibreOptions, we use it directly.
if (this.get('options')?.mapLibreOptions?.style) {
return this.get('options').mapLibreOptions.style;
}

/// Otherwise build the complete style url.
Expand Down

0 comments on commit 9039cc4

Please sign in to comment.