@defra/interactive-map 0.0.36-alpha → 0.0.37-alpha

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.
@@ -49,9 +49,21 @@ export default class EsriLayerAdapter extends LayerAdapter {
49
49
 
50
50
  // Finally show all layers that are visible based on the dataset/mapStyle visibility
51
51
  await Promise.all(topLevelDatasets.map(registryDataset => this.applyDatasetVisibility(registryDataset.id)))
52
+ this._reorderLayers()
52
53
  this.resolveReady()
53
54
  }
54
55
 
56
+ _reorderLayers () {
57
+ // Ensure that all sketch layers are on top of the map, so that they are not obscured by other layers
58
+ // Only applicable when the draw plugin is in use, but safe to call regardless
59
+ const layersLength = this._map?.allLayers?.items?.length
60
+ if (layersLength) {
61
+ this._map.allLayers.items
62
+ .filter((layer) => layer.id.includes('ketchLayer'))
63
+ .forEach((layer) => this._map.reorder(layer, layersLength))
64
+ }
65
+ }
66
+
55
67
  _addGroupLayer (esriGroupId) {
56
68
  // Either adds a new group layer to the map, or returns an existing one if it already exists
57
69
  if (!this._groupLayers[esriGroupId]) {
@@ -117,6 +129,7 @@ export default class EsriLayerAdapter extends LayerAdapter {
117
129
  await this._addLayers(registryDataset)
118
130
  const { parentId } = registryDataset
119
131
  const vectorTileLayer = this._mapVisibilityLayers[parentId || datasetId]
132
+ this._reorderLayers()
120
133
  this.applyDatasetOpacity(datasetId)
121
134
  this._applyStyleLayerPaintProperties(registryDataset, vectorTileLayer)
122
135
  this.applyDatasetVisibility(datasetId)