Better code indentation

This commit is contained in:
Frederic Junod
2018-02-28 16:46:45 +01:00
parent cf0c42ae7d
commit 73b15ef8d7
6 changed files with 29 additions and 41 deletions

View File

@@ -105,8 +105,7 @@ Observable.prototype.on = function(type, listener) {
}
return keys;
} else {
return listen(
this, /** @type {string} */ (type), listener);
return listen(this, /** @type {string} */ (type), listener);
}
};
@@ -129,8 +128,7 @@ Observable.prototype.once = function(type, listener) {
}
return keys;
} else {
return listenOnce(
this, /** @type {string} */ (type), listener);
return listenOnce(this, /** @type {string} */ (type), listener);
}
};

View File

@@ -361,50 +361,50 @@ const PluggableMap = function(options) {
this.controls.forEach(
/**
* @param {ol.control.Control} control Control.
* @this {ol.PluggableMap}
*/
* @param {ol.control.Control} control Control.
* @this {ol.PluggableMap}
*/
function(control) {
control.setMap(this);
}.bind(this));
listen(this.controls, CollectionEventType.ADD,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(this);
}, this);
listen(this.controls, CollectionEventType.REMOVE,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(null);
}, this);
this.interactions.forEach(
/**
* @param {ol.interaction.Interaction} interaction Interaction.
* @this {ol.PluggableMap}
*/
* @param {ol.interaction.Interaction} interaction Interaction.
* @this {ol.PluggableMap}
*/
function(interaction) {
interaction.setMap(this);
}.bind(this));
listen(this.interactions, CollectionEventType.ADD,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(this);
}, this);
listen(this.interactions, CollectionEventType.REMOVE,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(null);
}, this);
@@ -413,16 +413,16 @@ const PluggableMap = function(options) {
listen(this.overlays_, CollectionEventType.ADD,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
this.addOverlayInternal_(/** @type {ol.Overlay} */ (event.element));
}, this);
listen(this.overlays_, CollectionEventType.REMOVE,
/**
* @param {ol.CollectionEvent} event CollectionEvent.
*/
* @param {ol.CollectionEvent} event CollectionEvent.
*/
function(event) {
const overlay = /** @type {ol.Overlay} */ (event.element);
const id = overlay.getId();
@@ -685,9 +685,7 @@ PluggableMap.prototype.getTarget = function() {
PluggableMap.prototype.getTargetElement = function() {
const target = this.getTarget();
if (target !== undefined) {
return typeof target === 'string' ?
document.getElementById(target) :
target;
return typeof target === 'string' ? document.getElementById(target) : target;
} else {
return null;
}

View File

@@ -197,8 +197,7 @@ View.prototype.applyOptions_ = function(options) {
this.minResolution_, this.maxResolution_);
}
}
properties[ViewProperty.ROTATION] =
options.rotation !== undefined ? options.rotation : 0;
properties[ViewProperty.ROTATION] = options.rotation !== undefined ? options.rotation : 0;
this.setProperties(properties);
/**

View File

@@ -33,8 +33,7 @@ export function bindListener(listenerObj) {
* listener, for {@link ol.events.unlistenByKey}.
* @return {ol.EventsKey|undefined} The matching listener object.
*/
export function findListener(listeners, listener, opt_this,
opt_setDeleteIndex) {
export function findListener(listeners, listener, opt_this, opt_setDeleteIndex) {
let listenerObj;
for (let i = 0, ii = listeners.length; i < ii; ++i) {
listenerObj = listeners[i];
@@ -124,8 +123,7 @@ export function listen(target, type, listener, opt_this, opt_once) {
if (!listeners) {
listeners = listenerMap[type] = [];
}
let listenerObj = findListener(listeners, listener, opt_this,
false);
let listenerObj = findListener(listeners, listener, opt_this, false);
if (listenerObj) {
if (!opt_once) {
// Turn one-off listener into a permanent one.
@@ -188,8 +186,7 @@ export function listenOnce(target, type, listener, opt_this) {
export function unlisten(target, type, listener, opt_this) {
const listeners = getListeners(target, type);
if (listeners) {
const listenerObj = findListener(listeners, listener, opt_this,
true);
const listenerObj = findListener(listeners, listener, opt_this, true);
if (listenerObj) {
unlistenByKey(listenerObj);
}

View File

@@ -43,13 +43,11 @@ let HAS_WEBGL = false;
if ('WebGLRenderingContext' in window) {
try {
const canvas = /** @type {HTMLCanvasElement} */
(document.createElement('CANVAS'));
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('CANVAS'));
const gl = getContext(canvas, {failIfMajorPerformanceCaveat: true});
if (gl) {
HAS_WEBGL = true;
WEBGL_MAX_TEXTURE_SIZE = /** @type {number} */
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
WEBGL_MAX_TEXTURE_SIZE = /** @type {number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE));
WEBGL_EXTENSIONS = gl.getSupportedExtensions();
}
} catch (e) {

View File

@@ -48,10 +48,8 @@ export function tile(tileGrid) {
const extents = [];
/** @type {ol.TileCoord} */
const tileCoord = [z, 0, 0];
for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX;
++tileCoord[1]) {
for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY;
++tileCoord[2]) {
for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) {
for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) {
extents.push(tileGrid.getTileCoordExtent(tileCoord));
}
}