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,14 +1,13 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import Overlay from '../src/ol/Overlay.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {toStringHDMS} from '../src/ol/coordinate.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
|
||||
import Overlay from '../src/ol/Overlay.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
|
||||
import {toStringHDMS} from '../src/ol/coordinate.js';
|
||||
|
||||
const layer = new TileLayer({
|
||||
source: new OSM()
|
||||
source: new OSM(),
|
||||
});
|
||||
|
||||
const map = new Map({
|
||||
@@ -16,8 +15,8 @@ const map = new Map({
|
||||
target: 'map',
|
||||
view: new View({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
})
|
||||
zoom: 2,
|
||||
}),
|
||||
});
|
||||
|
||||
const pos = fromLonLat([16.3725, 48.208889]);
|
||||
@@ -27,24 +26,24 @@ const marker = new Overlay({
|
||||
position: pos,
|
||||
positioning: 'center-center',
|
||||
element: document.getElementById('marker'),
|
||||
stopEvent: false
|
||||
stopEvent: false,
|
||||
});
|
||||
map.addOverlay(marker);
|
||||
|
||||
// Vienna label
|
||||
const vienna = new Overlay({
|
||||
position: pos,
|
||||
element: document.getElementById('vienna')
|
||||
element: document.getElementById('vienna'),
|
||||
});
|
||||
map.addOverlay(vienna);
|
||||
|
||||
// Popup showing the position the user clicked
|
||||
const popup = new Overlay({
|
||||
element: document.getElementById('popup')
|
||||
element: document.getElementById('popup'),
|
||||
});
|
||||
map.addOverlay(popup);
|
||||
|
||||
map.on('click', function(evt) {
|
||||
map.on('click', function (evt) {
|
||||
const element = popup.getElement();
|
||||
const coordinate = evt.coordinate;
|
||||
const hdms = toStringHDMS(toLonLat(coordinate));
|
||||
@@ -55,7 +54,7 @@ map.on('click', function(evt) {
|
||||
placement: 'top',
|
||||
animation: false,
|
||||
html: true,
|
||||
content: '<p>The location you clicked was:</p><code>' + hdms + '</code>'
|
||||
content: '<p>The location you clicked was:</p><code>' + hdms + '</code>',
|
||||
});
|
||||
$(element).popover('show');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user