Don't include scale line in default controls

This commit is contained in:
Tom Payne
2013-03-06 20:33:56 +01:00
parent 6dab2cd466
commit 09b75f8044
3 changed files with 4 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ goog.require('ol.Coordinate');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control.ScaleLine');
goog.require('ol.control.ScaleLineUnits');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
@@ -24,13 +25,11 @@ var layers = [
];
var map = new ol.Map({
controls: ol.control.defaults({
scaleLine: true,
// FIXME The typecast here is only needed if the example is compiled
scaleLineOptions: /** @type {ol.control.ScaleLineOptions} */ ({
controls: ol.control.defaults({}, [
new ol.control.ScaleLine({
units: ol.control.ScaleLineUnits.DEGREES
})
}),
]),
layers: layers,
// The OSgeo server does not set cross origin headers, so we cannot use WebGL
renderers: [ol.RendererHint.CANVAS, ol.RendererHint.DOM],

View File

@@ -49,8 +49,6 @@
@exportObjectLiteral ol.control.DefaultsOptions
@exportObjectLiteralProperty ol.control.DefaultsOptions.attribution boolean|undefined
@exportObjectLiteralProperty ol.control.DefaultsOptions.attributionOptions ol.control.AttributionOptions|undefined
@exportObjectLiteralProperty ol.control.DefaultsOptions.scaleLine boolean|undefined
@exportObjectLiteralProperty ol.control.DefaultsOptions.scaleLineOptions ol.control.ScaleLineOptions|undefined
@exportObjectLiteralProperty ol.control.DefaultsOptions.zoom boolean|undefined
@exportObjectLiteralProperty ol.control.DefaultsOptions.zoomOptions ol.control.ZoomOptions|undefined

View File

@@ -2,7 +2,6 @@ goog.provide('ol.control.defaults');
goog.require('goog.array');
goog.require('ol.control.Attribution');
goog.require('ol.control.ScaleLine');
goog.require('ol.control.Zoom');
@@ -26,14 +25,6 @@ ol.control.defaults = function(opt_options, opt_controls) {
controls.push(new ol.control.Attribution(attributionControlOptions));
}
var scaleLineControl = goog.isDef(options.scaleLine) ?
options.scaleLine : false;
if (scaleLineControl) {
var scaleLineOptions = goog.isDef(options.scaleLineOptions) ?
options.scaleLineOptions : undefined;
controls.push(new ol.control.ScaleLine(scaleLineOptions));
}
var zoomControl = goog.isDef(options.zoom) ?
options.zoom : true;
if (zoomControl) {