Toward natural JavaScript syntax
This commit is contained in:
@@ -53,15 +53,14 @@ ol.control.Attribution = function(opt_options) {
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.collapsed_ = ol.isDef(options.collapsed) ?
|
||||
/** @type {boolean} */ (options.collapsed) : true;
|
||||
this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.collapsible_ = ol.isDef(options.collapsible) ?
|
||||
/** @type {boolean} */ (options.collapsible) : true;
|
||||
this.collapsible_ = options.collapsible !== undefined ?
|
||||
options.collapsible : true;
|
||||
|
||||
if (!this.collapsible_) {
|
||||
this.collapsed_ = false;
|
||||
|
||||
@@ -25,19 +25,17 @@ ol.control.defaults = function(opt_options) {
|
||||
|
||||
var controls = new ol.Collection();
|
||||
|
||||
var zoomControl = ol.isDef(options.zoom) ?
|
||||
options.zoom : true;
|
||||
var zoomControl = options.zoom !== undefined ? options.zoom : true;
|
||||
if (zoomControl) {
|
||||
controls.push(new ol.control.Zoom(options.zoomOptions));
|
||||
}
|
||||
|
||||
var rotateControl = ol.isDef(options.rotate) ?
|
||||
options.rotate : true;
|
||||
var rotateControl = options.rotate !== undefined ? options.rotate : true;
|
||||
if (rotateControl) {
|
||||
controls.push(new ol.control.Rotate(options.rotateOptions));
|
||||
}
|
||||
|
||||
var attributionControl = ol.isDef(options.attribution) ?
|
||||
var attributionControl = options.attribution !== undefined ?
|
||||
options.attribution : true;
|
||||
if (attributionControl) {
|
||||
controls.push(new ol.control.Attribution(options.attributionOptions));
|
||||
|
||||
@@ -83,8 +83,7 @@ ol.control.FullScreen = function(opt_options) {
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.keys_ = ol.isDef(options.keys) ?
|
||||
/** @type {boolean} */ (options.keys) : false;
|
||||
this.keys_ = options.keys !== undefined ? options.keys : false;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.FullScreen, ol.control.Control);
|
||||
|
||||
@@ -41,15 +41,14 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.collapsed_ = ol.isDef(options.collapsed) ?
|
||||
/** @type {boolean} */ (options.collapsed) : true;
|
||||
this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.collapsible_ = ol.isDef(options.collapsible) ?
|
||||
/** @type {boolean} */ (options.collapsible) : true;
|
||||
this.collapsible_ = options.collapsible !== undefined ?
|
||||
options.collapsible : true;
|
||||
|
||||
if (!this.collapsible_) {
|
||||
this.collapsed_ = false;
|
||||
@@ -382,7 +381,7 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
|
||||
goog.asserts.assertArray(ovmapSize, 'ovmapSize should be an array');
|
||||
|
||||
var rotation = view.getRotation();
|
||||
goog.asserts.assert(ol.isDef(rotation), 'rotation should be defined');
|
||||
goog.asserts.assert(rotation !== undefined, 'rotation should be defined');
|
||||
|
||||
var overlay = this.boxOverlay_;
|
||||
var box = this.boxOverlay_.getElement();
|
||||
|
||||
@@ -81,8 +81,7 @@ ol.control.Rotate = function(opt_options) {
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.autoHide_ = ol.isDef(options.autoHide) ?
|
||||
/** @type {boolean} */ (options.autoHide) : true;
|
||||
this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -126,7 +125,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
while (currentRotation > Math.PI) {
|
||||
currentRotation -= 2 * Math.PI;
|
||||
}
|
||||
if (ol.isDef(currentRotation)) {
|
||||
if (currentRotation !== undefined) {
|
||||
if (this.duration_ > 0) {
|
||||
map.beforeRender(ol.animation.rotate({
|
||||
rotation: currentRotation,
|
||||
|
||||
@@ -87,8 +87,7 @@ ol.control.ScaleLine = function(opt_options) {
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.minWidth_ = ol.isDef(options.minWidth) ?
|
||||
/** @type {number} */ (options.minWidth) : 64;
|
||||
this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user