Break the circular dependency by extending a pluggable map

This commit is contained in:
Tim Schaub
2019-05-17 12:18:37 -06:00
parent c10fd7aaab
commit c860f15f91
5 changed files with 73 additions and 74 deletions

View File

@@ -1,8 +1,8 @@
/**
* @module ol/control/OverviewMap
*/
import Collection from '../Collection.js';
import Map from '../Map.js';
import PluggableMap from '../PluggableMap.js';
import CompositeMapRenderer from '../renderer/Composite.js';
import MapEventType from '../MapEventType.js';
import MapProperty from '../MapProperty.js';
import {getChangeEventType} from '../Object.js';
@@ -35,6 +35,13 @@ const MAX_RATIO = 0.75;
const MIN_RATIO = 0.1;
class ControlledMap extends PluggableMap {
createRenderer() {
return new CompositeMapRenderer(this);
}
}
/**
* @typedef {Object} Options
* @property {string} [className='ol-overviewmap'] CSS class name.
@@ -143,12 +150,10 @@ class OverviewMap extends Control {
this.ovmapDiv_.className = 'ol-overviewmap-map';
/**
* @type {import("../Map.js").default}
* @type {ControlledMap}
* @private
*/
this.ovmap_ = new Map({
controls: new Collection(),
interactions: new Collection(),
this.ovmap_ = new ControlledMap({
view: options.view
});
const ovmap = this.ovmap_;