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 12, 2019
1 parent 5149d9a commit 340fea3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 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,18 @@ 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({
// @ts-ignore: layers param in overviewmap
layers: [layer],
collapsed: !options.miniMapExpanded,
view: new View({
projection: this.view_.getProjection(),
resolutions: this.view_.getResolutions()
})
}));
}
}
}

Expand Down

0 comments on commit 340fea3

Please sign in to comment.