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,16 @@
|
||||
/**
|
||||
* @module ol/interaction/DragZoom
|
||||
*/
|
||||
import DragBox from './DragBox.js';
|
||||
import {
|
||||
createOrUpdateFromCoordinates,
|
||||
getBottomLeft,
|
||||
getCenter,
|
||||
getTopRight,
|
||||
scaleFromCenter,
|
||||
} from '../extent.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import {shiftKeyOnly} from '../events/condition.js';
|
||||
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
|
||||
import DragBox from './DragBox.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -21,7 +26,6 @@ import DragBox from './DragBox.js';
|
||||
* `boxEndCondition` function.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by clicking and dragging on the map,
|
||||
@@ -45,7 +49,7 @@ class DragZoom extends DragBox {
|
||||
condition: condition,
|
||||
className: options.className || 'ol-dragzoom',
|
||||
minArea: options.minArea,
|
||||
onBoxEnd: onBoxEnd
|
||||
onBoxEnd: onBoxEnd,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -62,7 +66,6 @@ class DragZoom extends DragBox {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @this {DragZoom}
|
||||
*/
|
||||
@@ -76,23 +79,25 @@ function onBoxEnd() {
|
||||
const mapExtent = view.calculateExtentInternal(size);
|
||||
const boxPixelExtent = createOrUpdateFromCoordinates([
|
||||
map.getPixelFromCoordinateInternal(getBottomLeft(extent)),
|
||||
map.getPixelFromCoordinateInternal(getTopRight(extent))]);
|
||||
map.getPixelFromCoordinateInternal(getTopRight(extent)),
|
||||
]);
|
||||
const factor = view.getResolutionForExtentInternal(boxPixelExtent, size);
|
||||
|
||||
scaleFromCenter(mapExtent, 1 / factor);
|
||||
extent = mapExtent;
|
||||
}
|
||||
|
||||
const resolution = view.getConstrainedResolution(view.getResolutionForExtentInternal(extent, size));
|
||||
const resolution = view.getConstrainedResolution(
|
||||
view.getResolutionForExtentInternal(extent, size)
|
||||
);
|
||||
const center = view.getConstrainedCenter(getCenter(extent), resolution);
|
||||
|
||||
view.animateInternal({
|
||||
resolution: resolution,
|
||||
center: center,
|
||||
duration: this.duration_,
|
||||
easing: easeOut
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export default DragZoom;
|
||||
|
||||
Reference in New Issue
Block a user