Linting and fixes for unit tests

This commit is contained in:
Olivier Guyot
2019-01-15 17:45:21 +01:00
parent ef6d17d817
commit 433bccd207
14 changed files with 36 additions and 45 deletions

View File

@@ -934,7 +934,7 @@ class View extends BaseObject {
*/
getZoom() {
let zoom;
const resolution = this.targetResolution_;
const resolution = this.getResolution();
if (resolution !== undefined) {
zoom = this.getZoomForResolution(resolution);
}
@@ -1339,7 +1339,7 @@ class View extends BaseObject {
const direction = opt_direction || 0;
const size = this.getSizeFromViewport_(this.getRotation());
return(this.constraints_.resolution(targetResolution, direction, size));
return this.constraints_.resolution(targetResolution, direction, size);
}
}

View File

@@ -27,8 +27,8 @@ export function createExtent(extent, onlyCenter, smooth) {
*/
function(center, resolution, size, opt_isMoving) {
if (center) {
let viewWidth = onlyCenter ? 0 : size[0] * resolution;
let viewHeight = onlyCenter ? 0 : size[1] * resolution;
const viewWidth = onlyCenter ? 0 : size[0] * resolution;
const viewHeight = onlyCenter ? 0 : size[1] * resolution;
const minX = extent[0] + viewWidth / 2;
const maxX = extent[2] - viewWidth / 2;
const minY = extent[1] + viewHeight / 2;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/control/ZoomSlider
*/
import ViewHint from '../ViewHint.js';
import Control from './Control.js';
import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
import {easeOut} from '../easing.js';

View File

@@ -1,8 +1,7 @@
/**
* @module ol/interaction/DragPan
*/
import ViewHint from '../ViewHint.js';
import {scale as scaleCoordinate, rotate as rotateCoordinate, add as addCoordinate} from '../coordinate.js';
import {scale as scaleCoordinate, rotate as rotateCoordinate} from '../coordinate.js';
import {easeOut} from '../easing.js';
import {noModifierKeys} from '../events/condition.js';
import {FALSE} from '../functions.js';

View File

@@ -2,10 +2,8 @@
* @module ol/interaction/DragRotate
*/
import {disable} from '../rotationconstraint.js';
import ViewHint from '../ViewHint.js';
import {altShiftKeysOnly, mouseOnly, mouseActionButton} from '../events/condition.js';
import {FALSE} from '../functions.js';
import {rotate} from './Interaction.js';
import PointerInteraction from './Pointer.js';

View File

@@ -1,8 +1,6 @@
/**
* @module ol/interaction/DragRotateAndZoom
*/
import {disable} from '../rotationconstraint.js';
import ViewHint from '../ViewHint.js';
import {shiftKeyOnly, mouseOnly} from '../events/condition.js';
import PointerInteraction from './Pointer.js';

View File

@@ -1,9 +1,7 @@
/**
* @module ol/interaction/MouseWheelZoom
*/
import ViewHint from '../ViewHint.js';
import {always} from '../events/condition.js';
import {easeOut} from '../easing.js';
import EventType from '../events/EventType.js';
import {DEVICE_PIXEL_RATIO, FIREFOX, SAFARI} from '../has.js';
import Interaction, {zoomByDelta} from './Interaction.js';

View File

@@ -1,9 +1,7 @@
/**
* @module ol/interaction/PinchRotate
*/
import ViewHint from '../ViewHint.js';
import {FALSE} from '../functions.js';
import {rotate} from './Interaction.js';
import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js';
import {disable} from '../rotationconstraint.js';

View File

@@ -1,9 +1,7 @@
/**
* @module ol/interaction/PinchZoom
*/
import ViewHint from '../ViewHint.js';
import {FALSE} from '../functions.js';
import {zoom} from './Interaction.js';
import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js';

View File

@@ -2,8 +2,8 @@
* @module ol/resolutionconstraint
*/
import {linearFindNearest} from './array.js';
import {clamp} from './math.js';
import {getHeight, getWidth} from './extent';
import {clamp} from './math';
/**
@@ -123,7 +123,7 @@ export function createSnapToPower(power, maxResolution, opt_minResolution, opt_s
const capped = Math.min(cappedMaxRes, resolution);
const zoomLevel = Math.floor(
Math.log(maxResolution / capped) / Math.log(power) + offset);
let newResolution = maxResolution / Math.pow(power, zoomLevel);
const newResolution = maxResolution / Math.pow(power, zoomLevel);
return clamp(newResolution, minResolution, cappedMaxRes);
} else {
return undefined;

View File

@@ -71,7 +71,7 @@ export function createSnapToZero(opt_tolerance) {
return (
/**
* @param {number|undefined} rotation Rotation.
* @param {number} delta Delta.
* @param {boolean} opt_isMoving True if an interaction or animation is in progress.
* @return {number|undefined} Rotation.
*/
function(rotation, opt_isMoving) {