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.
42 lines
941 B
JavaScript
42 lines
941 B
JavaScript
/**
|
|
* @module ol/geom/flat/flip
|
|
*/
|
|
|
|
/**
|
|
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
* @param {number} offset Offset.
|
|
* @param {number} end End.
|
|
* @param {number} stride Stride.
|
|
* @param {Array<number>=} opt_dest Destination.
|
|
* @param {number=} opt_destOffset Destination offset.
|
|
* @return {Array<number>} Flat coordinates.
|
|
*/
|
|
export function flipXY(
|
|
flatCoordinates,
|
|
offset,
|
|
end,
|
|
stride,
|
|
opt_dest,
|
|
opt_destOffset
|
|
) {
|
|
let dest, destOffset;
|
|
if (opt_dest !== undefined) {
|
|
dest = opt_dest;
|
|
destOffset = opt_destOffset !== undefined ? opt_destOffset : 0;
|
|
} else {
|
|
dest = [];
|
|
destOffset = 0;
|
|
}
|
|
let j = offset;
|
|
while (j < end) {
|
|
const x = flatCoordinates[j++];
|
|
dest[destOffset++] = flatCoordinates[j++];
|
|
dest[destOffset++] = x;
|
|
for (let k = 2; k < stride; ++k) {
|
|
dest[destOffset++] = flatCoordinates[j++];
|
|
}
|
|
}
|
|
dest.length = destOffset;
|
|
return dest;
|
|
}
|