From 939aa565b5e8dc2c4d51c5ef25f33ded70ed5bd8 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 17 Oct 2018 10:37:32 +0200 Subject: [PATCH 1/2] Change ol/control/ScaleLine getUnits return type Remove `undefined` from the return type: the default value is 'metric' --- src/ol/control/ScaleLine.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ol/control/ScaleLine.js b/src/ol/control/ScaleLine.js index 2e8b163136..1aacaa20f4 100644 --- a/src/ol/control/ScaleLine.js +++ b/src/ol/control/ScaleLine.js @@ -121,22 +121,19 @@ class ScaleLine extends Control { this, getChangeEventType(UNITS_PROP), this.handleUnitsChanged_, this); - this.setUnits(/** @type {Units} */ (options.units) || - Units.METRIC); + this.setUnits(/** @type {Units} */ (options.units) || Units.METRIC); } /** * Return the units to use in the scale line. - * @return {Units|undefined} The units + * @return {Units} The units * to use in the scale line. * @observable * @api */ getUnits() { - return ( - /** @type {Units|undefined} */ (this.get(UNITS_PROP)) - ); + return this.get(UNITS_PROP); } /** From 94fd57f690471b1dc4e96050253c3afe910f3c69 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 17 Oct 2018 10:56:09 +0200 Subject: [PATCH 2/2] Set projection property in MousePosition option optional --- src/ol/control/MousePosition.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 23c77387f1..6b0dfcf870 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -23,7 +23,7 @@ const COORDINATE_FORMAT = 'coordinateFormat'; * @typedef {Object} Options * @property {string} [className='ol-mouse-position'] CSS class name. * @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format. - * @property {import("../proj.js").ProjectionLike} projection Projection. + * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. * @property {function(import("../MapEvent.js").default)} [render] Function called when the * control should be re-rendered. This is called in a `requestAnimationFrame` * callback.