Allow ol.control.ScaleLine units option to be a string
This commit is contained in:
@@ -236,8 +236,8 @@
|
|||||||
* @property {string|undefined} className CSS Class name. Default is `ol-scale-line`.
|
* @property {string|undefined} className CSS Class name. Default is `ol-scale-line`.
|
||||||
* @property {number|undefined} minWidth Minimum width in pixels. Default is `64`.
|
* @property {number|undefined} minWidth Minimum width in pixels. Default is `64`.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
* @property {ol.control.ScaleLineUnits|undefined} units Units.
|
* @property {ol.control.ScaleLineUnits|string|undefined} units Units.
|
||||||
* Default is `ol.control.ScaleLineUnits.METRIC`.
|
* Default is `metric`.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ ol.control.ScaleLine = function(opt_options) {
|
|||||||
this, ol.Object.getChangeEventType(ol.control.ScaleLineProperty.UNITS),
|
this, ol.Object.getChangeEventType(ol.control.ScaleLineProperty.UNITS),
|
||||||
this.handleUnitsChanged_, false, this);
|
this.handleUnitsChanged_, false, this);
|
||||||
|
|
||||||
this.setUnits(options.units || ol.control.ScaleLineUnits.METRIC);
|
this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) ||
|
||||||
|
ol.control.ScaleLineUnits.METRIC);
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.ScaleLine, ol.control.Control);
|
goog.inherits(ol.control.ScaleLine, ol.control.Control);
|
||||||
|
|||||||
Reference in New Issue
Block a user