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:
@@ -3,12 +3,10 @@
|
||||
*/
|
||||
import {clamp} from './math.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {function((import("./coordinate.js").Coordinate|undefined), number, import("./size.js").Size, boolean=): (import("./coordinate.js").Coordinate|undefined)} Type
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("./extent.js").Extent} extent Extent.
|
||||
* @param {boolean} onlyCenter If true, the constraint will only apply to the view center.
|
||||
@@ -25,7 +23,7 @@ export function createExtent(extent, onlyCenter, smooth) {
|
||||
* @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
|
||||
* @return {import("./coordinate.js").Coordinate|undefined} Center.
|
||||
*/
|
||||
function(center, resolution, size, opt_isMoving) {
|
||||
function (center, resolution, size, opt_isMoving) {
|
||||
if (center) {
|
||||
const viewWidth = onlyCenter ? 0 : size[0] * resolution;
|
||||
const viewHeight = onlyCenter ? 0 : size[1] * resolution;
|
||||
@@ -51,9 +49,11 @@ export function createExtent(extent, onlyCenter, smooth) {
|
||||
|
||||
// during an interaction, allow some overscroll
|
||||
if (opt_isMoving && smooth) {
|
||||
x += -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +
|
||||
x +=
|
||||
-ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +
|
||||
ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);
|
||||
y += -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +
|
||||
y +=
|
||||
-ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +
|
||||
ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ export function createExtent(extent, onlyCenter, smooth) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("./coordinate.js").Coordinate=} center Center.
|
||||
* @return {import("./coordinate.js").Coordinate|undefined} Center.
|
||||
|
||||
Reference in New Issue
Block a user