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:
+12
-12
@@ -2,10 +2,9 @@
|
||||
* @module ol/control/Rotate
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -23,7 +22,6 @@ import EventType from '../events/EventType.js';
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control to reset rotation to 0.
|
||||
@@ -33,21 +31,20 @@ import EventType from '../events/EventType.js';
|
||||
* @api
|
||||
*/
|
||||
class Rotate extends Control {
|
||||
|
||||
/**
|
||||
* @param {Options=} opt_options Rotate options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
super({
|
||||
element: document.createElement('div'),
|
||||
render: options.render || render,
|
||||
target: options.target
|
||||
target: options.target,
|
||||
});
|
||||
|
||||
const className = options.className !== undefined ? options.className : 'ol-rotate';
|
||||
const className =
|
||||
options.className !== undefined ? options.className : 'ol-rotate';
|
||||
|
||||
const label = options.label !== undefined ? options.label : '\u21E7';
|
||||
|
||||
@@ -74,9 +71,14 @@ class Rotate extends Control {
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.label_);
|
||||
|
||||
button.addEventListener(EventType.CLICK, this.handleClick_.bind(this), false);
|
||||
button.addEventListener(
|
||||
EventType.CLICK,
|
||||
this.handleClick_.bind(this),
|
||||
false
|
||||
);
|
||||
|
||||
const cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
const cssClasses =
|
||||
className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
const element = this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
@@ -104,7 +106,6 @@ class Rotate extends Control {
|
||||
if (this.autoHide_) {
|
||||
this.element.classList.add(CLASS_HIDDEN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +138,7 @@ class Rotate extends Control {
|
||||
view.animate({
|
||||
rotation: 0,
|
||||
duration: this.duration_,
|
||||
easing: easeOut
|
||||
easing: easeOut,
|
||||
});
|
||||
} else {
|
||||
view.setRotation(0);
|
||||
@@ -146,7 +147,6 @@ class Rotate extends Control {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the rotate control element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
|
||||
Reference in New Issue
Block a user