Better code indentation

This commit is contained in:
Frederic Junod
2018-05-14 14:42:08 +02:00
parent 9f3b103bbf
commit 90ce02941a
7 changed files with 24 additions and 43 deletions

View File

@@ -303,12 +303,9 @@ const PluggableMap = function(options) {
*/
this.keyHandlerKeys_ = null;
listen(this.viewport_, EventType.CONTEXTMENU,
this.handleBrowserEvent, this);
listen(this.viewport_, EventType.WHEEL,
this.handleBrowserEvent, this);
listen(this.viewport_, EventType.MOUSEWHEEL,
this.handleBrowserEvent, this);
listen(this.viewport_, EventType.CONTEXTMENU, this.handleBrowserEvent, this);
listen(this.viewport_, EventType.WHEEL, this.handleBrowserEvent, this);
listen(this.viewport_, EventType.MOUSEWHEEL, this.handleBrowserEvent, this);
/**
* @type {module:ol/Collection.<module:ol/control/Control>}

View File

@@ -27,20 +27,18 @@ const TileQueue = function(tilePriorityFunction, tileChangeCallback) {
PriorityQueue.call(
this,
/**
* @param {Array} element Element.
* @return {number} Priority.
*/
* @param {Array} element Element.
* @return {number} Priority.
*/
function(element) {
return tilePriorityFunction.apply(null, element);
},
/**
* @param {Array} element Element.
* @return {string} Key.
*/
* @param {Array} element Element.
* @return {string} Key.
*/
function(element) {
return (
/** @type {module:ol/Tile} */ (element[0]).getKey()
);
return (/** @type {module:ol/Tile} */ (element[0]).getKey());
});
/**
@@ -73,8 +71,7 @@ TileQueue.prototype.enqueue = function(element) {
const added = PriorityQueue.prototype.enqueue.call(this, element);
if (added) {
const tile = element[0];
listen(tile, EventType.CHANGE,
this.handleTileChange, this);
listen(tile, EventType.CHANGE, this.handleTileChange, this);
}
return added;
};
@@ -97,8 +94,7 @@ TileQueue.prototype.handleTileChange = function(event) {
const state = tile.getState();
if (state === TileState.LOADED || state === TileState.ERROR ||
state === TileState.EMPTY || state === TileState.ABORT) {
unlisten(tile, EventType.CHANGE,
this.handleTileChange, this);
unlisten(tile, EventType.CHANGE, this.handleTileChange, this);
const tileKey = tile.getKey();
if (tileKey in this.tilesLoadingKeys_) {
delete this.tilesLoadingKeys_[tileKey];

View File

@@ -280,8 +280,7 @@ View.prototype.applyOptions_ = function(options) {
properties[ViewProperty.CENTER] = options.center !== undefined ?
options.center : null;
const resolutionConstraintInfo = createResolutionConstraint(
options);
const resolutionConstraintInfo = createResolutionConstraint(options);
/**
* @private
@@ -638,10 +637,8 @@ View.prototype.calculateCenterZoom = function(resolution, anchor) {
const currentCenter = this.getCenter();
const currentResolution = this.getResolution();
if (currentCenter !== undefined && currentResolution !== undefined) {
const x = anchor[0] -
resolution * (anchor[0] - currentCenter[0]) / currentResolution;
const y = anchor[1] -
resolution * (anchor[1] - currentCenter[1]) / currentResolution;
const x = anchor[0] - resolution * (anchor[0] - currentCenter[0]) / currentResolution;
const y = anchor[1] - resolution * (anchor[1] - currentCenter[1]) / currentResolution;
center = [x, y];
}
return center;
@@ -922,8 +919,7 @@ View.prototype.getValueForResolutionFunction = function(opt_power) {
* @return {number} Value.
*/
function(resolution) {
const value =
(Math.log(maxResolution / resolution) / Math.log(power)) / max;
const value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;
return value;
});
};

View File

@@ -117,8 +117,7 @@ MouseSource.prototype.isEventSimulatedFromTouch_ = function(inEvent) {
// simulated mouse events will be swallowed near a primary touchend
const dx = Math.abs(x - t[0]);
const dy = Math.abs(y - t[1]);
if (dx <= DEDUP_DIST &&
dy <= DEDUP_DIST) {
if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {
return true;
}
}

View File

@@ -177,8 +177,7 @@ MsSource.prototype.msPointerCancel = function(inEvent) {
* @param {MSPointerEvent} inEvent The in event.
*/
MsSource.prototype.msLostPointerCapture = function(inEvent) {
const e = this.dispatcher.makeEvent('lostpointercapture',
inEvent, inEvent);
const e = this.dispatcher.makeEvent('lostpointercapture', inEvent, inEvent);
this.dispatcher.dispatchEvent(e);
};
@@ -189,8 +188,7 @@ MsSource.prototype.msLostPointerCapture = function(inEvent) {
* @param {MSPointerEvent} inEvent The in event.
*/
MsSource.prototype.msGotPointerCapture = function(inEvent) {
const e = this.dispatcher.makeEvent('gotpointercapture',
inEvent, inEvent);
const e = this.dispatcher.makeEvent('gotpointercapture', inEvent, inEvent);
this.dispatcher.dispatchEvent(e);
};
export default MsSource;

View File

@@ -122,8 +122,7 @@ TouchSource.prototype.isPrimaryTouch_ = function(inTouch) {
*/
TouchSource.prototype.setPrimaryTouch_ = function(inTouch) {
const count = Object.keys(this.pointerMap).length;
if (count === 0 || (count === 1 &&
POINTER_ID.toString() in this.pointerMap)) {
if (count === 0 || (count === 1 && POINTER_ID.toString() in this.pointerMap)) {
this.firstTouchId_ = inTouch.identifier;
this.cancelResetClickCount_();
}
@@ -213,8 +212,7 @@ TouchSource.prototype.touchToPointer_ = function(browserEvent, inTouch) {
* @param {function(Event, Object)} inFunction In function.
*/
TouchSource.prototype.processTouches_ = function(inEvent, inFunction) {
const touches = Array.prototype.slice.call(
inEvent.changedTouches);
const touches = Array.prototype.slice.call(inEvent.changedTouches);
const count = touches.length;
function preventDefault() {
inEvent.preventDefault();
@@ -271,8 +269,7 @@ TouchSource.prototype.vacuumTouches_ = function(inEvent) {
// Never remove pointerId == 1, which is mouse.
// Touch identifiers are 2 smaller than their pointerId, which is the
// index in pointermap.
if (key != POINTER_ID &&
!this.findTouch_(touchList, key - 2)) {
if (key != POINTER_ID && !this.findTouch_(touchList, key - 2)) {
d.push(value.out);
}
}

View File

@@ -195,8 +195,7 @@ AtlasManager.prototype.add = function(id, width, height,
}
/** @type {?module:ol/style/Atlas~AtlasInfo} */
const info = this.add_(false,
id, width, height, renderCallback, opt_this);
const info = this.add_(false, id, width, height, renderCallback, opt_this);
if (!info) {
return null;
}
@@ -227,8 +226,7 @@ AtlasManager.prototype.add = function(id, width, height,
* @return {?module:ol/style/Atlas~AtlasInfo} The position and atlas image for the entry,
* or `null` if the image is too big.
*/
AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height,
renderCallback, opt_this) {
AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height, renderCallback, opt_this) {
const atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_;
let atlas, info, i, ii;
for (i = 0, ii = atlases.length; i < ii; ++i) {