Add rotate control to defaults.

This commit is contained in:
Antoine Abt
2014-04-30 11:35:46 +02:00
parent 229ae5e883
commit 04fd0ecf53
2 changed files with 17 additions and 0 deletions

View File

@@ -683,6 +683,7 @@ olx.control.ControlOptions.prototype.target;
* logo: (boolean|undefined),
* logoOptions: (olx.control.LogoOptions|undefined),
* zoom: (boolean|undefined),
* rotateOptions: (olx.control.RotateOptions|undefined)}}
* zoomOptions: (olx.control.ZoomOptions|undefined)}}
* @todo api
*/
@@ -724,6 +725,13 @@ olx.control.DefaultsOptions.prototype.logoOptions;
olx.control.DefaultsOptions.prototype.zoom;
/**
* Rotate options.
* @type {olx.control.RotateOptions|undefined}
*/
olx.control.DefaultsOptions.prototype.rotateOptions;
/**
* Zoom options.
* @type {olx.control.ZoomOptions|undefined}

View File

@@ -3,6 +3,7 @@ goog.provide('ol.control');
goog.require('ol.Collection');
goog.require('ol.control.Attribution');
goog.require('ol.control.Logo');
goog.require('ol.control.Rotate');
goog.require('ol.control.Zoom');
@@ -25,6 +26,14 @@ ol.control.defaults = function(opt_options) {
controls.push(new ol.control.Zoom(zoomControlOptions));
}
var rotateControl = goog.isDef(options.rotate) ?
options.rotate : true;
if (rotateControl) {
var rotateControlOptions = goog.isDef(options.rotateOptions) ?
options.rotateOptions : undefined;
controls.push(new ol.control.Rotate(rotateControlOptions));
}
var attributionControl = goog.isDef(options.attribution) ?
options.attribution : true;
if (attributionControl) {