Add scale line control options to map options
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
@exportObjectLiteralProperty ol.MapOptions.mouseWheelZoomDelta number|undefined
|
@exportObjectLiteralProperty ol.MapOptions.mouseWheelZoomDelta number|undefined
|
||||||
@exportObjectLiteralProperty ol.MapOptions.renderer ol.RendererHint|undefined
|
@exportObjectLiteralProperty ol.MapOptions.renderer ol.RendererHint|undefined
|
||||||
@exportObjectLiteralProperty ol.MapOptions.renderers Array.<ol.RendererHint>|undefined
|
@exportObjectLiteralProperty ol.MapOptions.renderers Array.<ol.RendererHint>|undefined
|
||||||
|
@exportObjectLiteralProperty ol.MapOptions.scaleLineControl boolean|undefined
|
||||||
|
@exportObjectLiteralProperty ol.MapOptions.scaleLineUnits ol.control.ScaleLineUnits|undefined
|
||||||
@exportObjectLiteralProperty ol.MapOptions.shiftDragZoom boolean|undefined
|
@exportObjectLiteralProperty ol.MapOptions.shiftDragZoom boolean|undefined
|
||||||
@exportObjectLiteralProperty ol.MapOptions.target Element|string
|
@exportObjectLiteralProperty ol.MapOptions.target Element|string
|
||||||
@exportObjectLiteralProperty ol.MapOptions.touchPan boolean|undefined
|
@exportObjectLiteralProperty ol.MapOptions.touchPan boolean|undefined
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ goog.require('ol.View');
|
|||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.control.Attribution');
|
goog.require('ol.control.Attribution');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
|
goog.require('ol.control.ScaleLine');
|
||||||
goog.require('ol.control.Zoom');
|
goog.require('ol.control.Zoom');
|
||||||
goog.require('ol.interaction.DblClickZoom');
|
goog.require('ol.interaction.DblClickZoom');
|
||||||
goog.require('ol.interaction.DragPan');
|
goog.require('ol.interaction.DragPan');
|
||||||
@@ -925,6 +926,16 @@ ol.Map.createControls_ = function(mapOptions) {
|
|||||||
controls.push(new ol.control.Attribution({}));
|
controls.push(new ol.control.Attribution({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var scaleLineControl = goog.isDef(mapOptions.scaleLineControl) ?
|
||||||
|
mapOptions.scaleLineControl : false;
|
||||||
|
if (scaleLineControl) {
|
||||||
|
var scaleLineUnits = goog.isDef(mapOptions.scaleLineUnits) ?
|
||||||
|
mapOptions.scaleLineUnits : undefined;
|
||||||
|
controls.push(new ol.control.ScaleLine({
|
||||||
|
units: scaleLineUnits
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
var zoomControl = goog.isDef(mapOptions.zoomControl) ?
|
var zoomControl = goog.isDef(mapOptions.zoomControl) ?
|
||||||
mapOptions.zoomControl : true;
|
mapOptions.zoomControl : true;
|
||||||
if (zoomControl) {
|
if (zoomControl) {
|
||||||
|
|||||||
Reference in New Issue
Block a user