Fix the OverviewMap control & example

Layers must now always be specified for the control.
Base example was amended to reflect that.

The breaking change was added in the update notes.
This commit is contained in:
Olivier Guyot
2018-11-14 19:34:53 +01:00
parent 50ae34fcc6
commit 593632daea
4 changed files with 17 additions and 11 deletions

View File

@@ -44,9 +44,8 @@ const MIN_RATIO = 0.1;
* @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
* @property {string|HTMLElement} [label='»'] Text label to use for the collapsed
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {Array<import("../layer/Layer.js").default>|import("../Collection.js").default<import("../layer/Layer.js").default>} [layers]
* Layers for the overview map. If not set, then all main map layers are used
* instead.
* @property {Array<import("../layer/Layer.js").default>|import("../Collection.js").default<import("../layer/Layer.js").default>} layers
* Layers for the overview map (mandatory).
* @property {function(import("../MapEvent.js").default)} [render] Function called when the control
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
* @property {HTMLElement|string} [target] Specify a target if you want the control
@@ -251,11 +250,6 @@ class OverviewMap extends Control {
map, ObjectEventType.PROPERTYCHANGE,
this.handleMapPropertyChange_, this));
// TODO: to really support map switching, this would need to be reworked
if (this.ovmap_.getLayers().getLength() === 0) {
this.ovmap_.setLayerGroup(map.getLayerGroup());
}
const view = map.getView();
if (view) {
this.bindView_(view);