Skip to content

Commit

Permalink
Only add the background layer to the overview map
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Dec 11, 2019
1 parent 5149d9a commit e901107
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions api/src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ class Map {
coordinateFormat: createStringXY(0)
}));
}
if (options.addMiniMap) {
this.map_.addControl(new OverviewMap({
collapsed: !options.miniMapExpanded,
view: new View({
projection: this.view_.getProjection(),
resolutions: this.view_.getResolutions()
})
}));
}

if (options.addLayerSwitcher) {
this.map_.addControl(new LayerSwitcher());
Expand All @@ -128,6 +119,17 @@ class Map {
// we don't want the background layer in the layerswitch so we remove the title.
layer.set('title', undefined);
this.map_.addLayer(layer);

if (options.addMiniMap) {
this.map_.addControl(new OverviewMap({
layers: [layer],
collapsed: !options.miniMapExpanded,
view: new View({
projection: this.view_.getProjection(),
resolutions: this.view_.getResolutions()
})
}));
}
}
}

Expand Down

0 comments on commit e901107

Please sign in to comment.