diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index 0fc75f9325..b3c0104fee 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -1,7 +1,7 @@ /** * @module ol/control/OverviewMap */ -import {OVERVIEWMAP_MAX_RATIO, OVERVIEWMAP_MIN_RATIO, inherits} from '../index.js'; +import {inherits} from '../index.js'; import _ol_Collection_ from '../Collection.js'; import _ol_PluggableMap_ from '../PluggableMap.js'; import _ol_MapEventType_ from '../MapEventType.js'; @@ -19,6 +19,21 @@ import _ol_events_ from '../events.js'; import _ol_events_EventType_ from '../events/EventType.js'; import _ol_extent_ from '../extent.js'; + +/** + * @type {number} Maximum width and/or height extent ratio that determines + * when the overview map should be zoomed out. + */ +var MAX_RATIO = 0.75; + + +/** + * @type {number} Minimum width and/or height extent ratio that determines + * when the overview map should be zoomed in. + */ +var MIN_RATIO = 0.1; + + /** * Create a new control with a map acting as an overview map for an other * defined map. @@ -336,10 +351,10 @@ _ol_control_OverviewMap_.prototype.validateExtent_ = function() { var ovmapWidth = ovmapSize[0]; var ovmapHeight = ovmapSize[1]; - if (boxWidth < ovmapWidth * OVERVIEWMAP_MIN_RATIO || - boxHeight < ovmapHeight * OVERVIEWMAP_MIN_RATIO || - boxWidth > ovmapWidth * OVERVIEWMAP_MAX_RATIO || - boxHeight > ovmapHeight * OVERVIEWMAP_MAX_RATIO) { + if (boxWidth < ovmapWidth * MIN_RATIO || + boxHeight < ovmapHeight * MIN_RATIO || + boxWidth > ovmapWidth * MAX_RATIO || + boxHeight > ovmapHeight * MAX_RATIO) { this.resetExtent_(); } else if (!_ol_extent_.containsExtent(ovextent, extent)) { this.recenter_(); @@ -353,7 +368,7 @@ _ol_control_OverviewMap_.prototype.validateExtent_ = function() { * @private */ _ol_control_OverviewMap_.prototype.resetExtent_ = function() { - if (OVERVIEWMAP_MAX_RATIO === 0 || OVERVIEWMAP_MIN_RATIO === 0) { + if (MAX_RATIO === 0 || MIN_RATIO === 0) { return; } @@ -371,8 +386,8 @@ _ol_control_OverviewMap_.prototype.resetExtent_ = function() { // box sizes using the min and max ratio, pick the step in the middle used // to calculate the extent from the main map to set it to the overview map, var steps = Math.log( - OVERVIEWMAP_MAX_RATIO / OVERVIEWMAP_MIN_RATIO) / Math.LN2; - var ratio = 1 / (Math.pow(2, steps / 2) * OVERVIEWMAP_MIN_RATIO); + MAX_RATIO / MIN_RATIO) / Math.LN2; + var ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO); _ol_extent_.scaleFromCenter(extent, ratio); ovview.fit(extent); }; diff --git a/src/ol/index.js b/src/ol/index.js index 7fedbfe2cb..174b3400e1 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -62,22 +62,6 @@ export var ENABLE_WEBGL = true; export var DEBUG_WEBGL = true; -/** - * TODO: move this to OverviewMap.js - * @type {number} Maximum width and/or height extent ratio that determines - * when the overview map should be zoomed out. - */ -export var OVERVIEWMAP_MAX_RATIO = 0.75; - - -/** - * TODO: move this to OverviewMap.js - * @type {number} Minimum width and/or height extent ratio that determines - * when the overview map should be zoomed in. - */ -export var OVERVIEWMAP_MIN_RATIO = 0.1; - - /** * TODO: move this to Triangulation.js * @type {number} Maximum number of subdivision steps during raster @@ -227,8 +211,6 @@ export default { ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION, ENABLE_WEBGL: ENABLE_WEBGL, DEBUG_WEBGL: DEBUG_WEBGL, - OVERVIEWMAP_MAX_RATIO: OVERVIEWMAP_MAX_RATIO, - OVERVIEWMAP_MIN_RATIO: OVERVIEWMAP_MIN_RATIO, RASTER_REPROJECTION_MAX_SUBDIVISION: RASTER_REPROJECTION_MAX_SUBDIVISION, RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH: RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH, SIMPLIFY_TOLERANCE: SIMPLIFY_TOLERANCE,