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:
@@ -1,11 +1,12 @@
|
||||
/**
|
||||
* @module ol/interaction/PinchRotate
|
||||
*/
|
||||
import PointerInteraction, {
|
||||
centroid as centroidFromPointers,
|
||||
} from './Pointer.js';
|
||||
import {FALSE} from '../functions.js';
|
||||
import PointerInteraction, {centroid as centroidFromPointers} from './Pointer.js';
|
||||
import {disable} from '../rotationconstraint.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=250] The duration of the animation in
|
||||
@@ -13,7 +14,6 @@ import {disable} from '../rotationconstraint.js';
|
||||
* @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to rotate the map by twisting with two fingers
|
||||
@@ -25,7 +25,6 @@ class PinchRotate extends PointerInteraction {
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
|
||||
@@ -71,7 +70,6 @@ class PinchRotate extends PointerInteraction {
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,13 +85,13 @@ class PinchRotate extends PointerInteraction {
|
||||
// angle between touches
|
||||
const angle = Math.atan2(
|
||||
touch1.clientY - touch0.clientY,
|
||||
touch1.clientX - touch0.clientX);
|
||||
touch1.clientX - touch0.clientX
|
||||
);
|
||||
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
const delta = angle - this.lastAngle_;
|
||||
this.rotationDelta_ += delta;
|
||||
if (!this.rotating_ &&
|
||||
Math.abs(this.rotationDelta_) > this.threshold_) {
|
||||
if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {
|
||||
this.rotating_ = true;
|
||||
}
|
||||
rotationDelta = delta;
|
||||
|
||||
Reference in New Issue
Block a user