ol-mapbox-style
Advanced tools
Comparing version 10.3.0 to 10.3.1
@@ -5,2 +5,6 @@ # Changelog | ||
## 10.3.1 | ||
* Fix initial visibility of `vector` and `geojson` source layers | ||
## 10.3.0 | ||
@@ -7,0 +11,0 @@ |
{ | ||
"name": "ol-mapbox-style", | ||
"version": "10.3.0", | ||
"version": "10.3.1", | ||
"description": "Create OpenLayers maps from Mapbox Style objects", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -809,4 +809,8 @@ /* | ||
function manageVisibility(layer, mapOrGroup) { | ||
layer.on('change', function () { | ||
const mapboxLayers = derefLayers(mapOrGroup.get('mapbox-style').layers); | ||
function onChange() { | ||
const glStyle = mapOrGroup.get('mapbox-style'); | ||
if (!glStyle) { | ||
return; | ||
} | ||
const mapboxLayers = derefLayers(glStyle.layers); | ||
const layerMapboxLayerids = layer.get('mapbox-layers'); | ||
@@ -827,3 +831,5 @@ const visible = mapboxLayers | ||
} | ||
}); | ||
} | ||
layer.on('change', onChange); | ||
onChange(); | ||
} | ||
@@ -911,3 +917,2 @@ | ||
layer = setupVectorLayer(glSource, styleUrl, options); | ||
manageVisibility(layer, mapOrGroup); | ||
} else if (glSource.type == 'raster') { | ||
@@ -925,3 +930,2 @@ layerIds = []; | ||
layer = setupGeoJSONLayer(glSource, styleUrl, options); | ||
manageVisibility(layer, mapOrGroup); | ||
} else if ( | ||
@@ -1196,3 +1200,3 @@ glSource.type == 'raster-dem' && | ||
.then(function () { | ||
layer.setVisible(true); | ||
manageVisibility(layer, mapOrGroup); | ||
resolve(); | ||
@@ -1199,0 +1203,0 @@ }) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6473783
21591