mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-19 09:22:12 +00:00
progress
This commit is contained in:
1 parent
ce8398f749
commit
41b9116c6a
60 files changed
+7525
-340
No files matched your search
@@ -1,16 +1,3 @@
|
||||
import type { SelectMode } from './types';
|
||||
|
||||
export type Wasm = typeof import('gpx-rs');
|
||||
|
||||
/** The enumeration of the engine for a way to combine a selection. */
|
||||
export function selectMode(wasm: Wasm, mode: SelectMode) {
|
||||
return {
|
||||
replace: wasm.SelectMode.Replace,
|
||||
add: wasm.SelectMode.Add,
|
||||
toggle: wasm.SelectMode.Toggle,
|
||||
}[mode];
|
||||
}
|
||||
|
||||
/** A flat `[lng, lat, ...]` array as positions. */
|
||||
export function toPositions(flat: Float64Array): [number, number][] {
|
||||
const positions: [number, number][] = new Array(flat.length / 2);
|
||||
@@ -19,15 +6,3 @@ export function toPositions(flat: Float64Array): [number, number][] {
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
export /** Hyphenated UUID strings (as found in the file structures) to the concatenated 16-byte form. */
|
||||
function idsToBytes(ids: string[]): Uint8Array {
|
||||
const bytes = new Uint8Array(ids.length * 16);
|
||||
ids.forEach((id, i) => {
|
||||
const hex = id.replaceAll('-', '');
|
||||
for (let j = 0; j < 16; j++) {
|
||||
bytes[i * 16 + j] = parseInt(hex.slice(2 * j, 2 * j + 2), 16);
|
||||
}
|
||||
});
|
||||
return bytes;
|
||||
}
|
||||
Reference in new issue
Block a user