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:
@@ -7,7 +7,7 @@ import {VERSION} from '../util.js';
|
||||
/** @type {any} */
|
||||
const worker = self;
|
||||
|
||||
worker.onmessage = event => {
|
||||
worker.onmessage = (event) => {
|
||||
console.log('version worker received message:', event.data); // eslint-disable-line
|
||||
worker.postMessage(`version: ${VERSION}`);
|
||||
};
|
||||
|
||||
+19
-10
@@ -4,14 +4,14 @@
|
||||
*/
|
||||
import {
|
||||
WebGLWorkerMessageType,
|
||||
writePointFeatureToBuffers
|
||||
writePointFeatureToBuffers,
|
||||
} from '../renderer/webgl/Layer.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/** @type {any} */
|
||||
const worker = self;
|
||||
|
||||
worker.onmessage = event => {
|
||||
worker.onmessage = (event) => {
|
||||
const received = event.data;
|
||||
if (received.type === WebGLWorkerMessageType.GENERATE_BUFFERS) {
|
||||
// This is specific to point features (x, y, index)
|
||||
@@ -24,7 +24,8 @@ worker.onmessage = event => {
|
||||
|
||||
const elementsCount = renderInstructions.length / instructionsCount;
|
||||
const indicesCount = elementsCount * 6;
|
||||
const verticesCount = elementsCount * 4 * (customAttrsCount + baseVertexAttrsCount);
|
||||
const verticesCount =
|
||||
elementsCount * 4 * (customAttrsCount + baseVertexAttrsCount);
|
||||
const indexBuffer = new Uint32Array(indicesCount);
|
||||
const vertexBuffer = new Float32Array(verticesCount);
|
||||
|
||||
@@ -36,17 +37,25 @@ worker.onmessage = event => {
|
||||
vertexBuffer,
|
||||
indexBuffer,
|
||||
customAttrsCount,
|
||||
bufferPositions);
|
||||
bufferPositions
|
||||
);
|
||||
}
|
||||
|
||||
/** @type {import('../renderer/webgl/Layer').WebGLWorkerGenerateBuffersMessage} */
|
||||
const message = assign({
|
||||
vertexBuffer: vertexBuffer.buffer,
|
||||
indexBuffer: indexBuffer.buffer,
|
||||
renderInstructions: renderInstructions.buffer
|
||||
}, received);
|
||||
const message = assign(
|
||||
{
|
||||
vertexBuffer: vertexBuffer.buffer,
|
||||
indexBuffer: indexBuffer.buffer,
|
||||
renderInstructions: renderInstructions.buffer,
|
||||
},
|
||||
received
|
||||
);
|
||||
|
||||
worker.postMessage(message, [vertexBuffer.buffer, indexBuffer.buffer, renderInstructions.buffer]);
|
||||
worker.postMessage(message, [
|
||||
vertexBuffer.buffer,
|
||||
indexBuffer.buffer,
|
||||
renderInstructions.buffer,
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user