Make code prettier

This updates ESLint and our shared eslint-config-openlayers to use Prettier.  Most formatting changes were automatically applied with this:

    npm run lint -- --fix

A few manual changes were required:

 * In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
 * In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason.  While editing this, I reworked `ExampleBuilder` to be a class.
 * In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
Tim Schaub
2020-04-06 12:25:12 -06:00
parent 53b48baf62
commit 054af09032
790 changed files with 46833 additions and 33765 deletions
+17 -14
View File
@@ -1,12 +1,16 @@
/**
* @module ol/interaction/DragPan
*/
import {scale as scaleCoordinate, rotate as rotateCoordinate} from '../coordinate.js';
import {easeOut} from '../easing.js';
import {noModifierKeys, primaryAction, focus} from '../events/condition.js';
import PointerInteraction, {
centroid as centroidFromPointers,
} from './Pointer.js';
import {FALSE} from '../functions.js';
import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js';
import {easeOut} from '../easing.js';
import {focus, noModifierKeys, primaryAction} from '../events/condition.js';
import {
rotate as rotateCoordinate,
scale as scaleCoordinate,
} from '../coordinate.js';
/**
* @typedef {Object} Options
@@ -18,7 +22,6 @@ import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js
* @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
*/
/**
* @classdesc
* Allows the user to pan the map by dragging the map.
@@ -29,9 +32,8 @@ class DragPan extends PointerInteraction {
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
super({
stopDown: FALSE
stopDown: FALSE,
});
const options = opt_options ? opt_options : {};
@@ -68,7 +70,6 @@ class DragPan extends PointerInteraction {
* @type {boolean}
*/
this.noKinetic_ = false;
}
/**
@@ -84,7 +85,6 @@ class DragPan extends PointerInteraction {
return pass && this.condition_(mapBrowserEvent);
}
/**
* Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
@@ -103,7 +103,7 @@ class DragPan extends PointerInteraction {
if (this.lastCentroid) {
const delta = [
this.lastCentroid[0] - centroid[0],
centroid[1] - this.lastCentroid[1]
centroid[1] - this.lastCentroid[1],
];
const map = mapBrowserEvent.map;
const view = map.getView();
@@ -137,12 +137,12 @@ class DragPan extends PointerInteraction {
const centerpx = map.getPixelFromCoordinateInternal(center);
const dest = map.getCoordinateFromPixelInternal([
centerpx[0] - distance * Math.cos(angle),
centerpx[1] - distance * Math.sin(angle)
centerpx[1] - distance * Math.sin(angle),
]);
view.animateInternal({
center: view.getConstrainedCenter(dest),
duration: 500,
easing: easeOut
easing: easeOut,
});
}
if (this.panning_) {
@@ -167,7 +167,10 @@ class DragPan extends PointerInteraction {
* @return {boolean} If the event was consumed.
*/
handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) {
if (
this.targetPointers.length > 0 &&
this.conditionInternal_(mapBrowserEvent)
) {
const map = mapBrowserEvent.map;
const view = map.getView();
this.lastCentroid = null;