Add panorama previews and repair beta export rendering
This commit is contained in:
16
shared/draft-selection.ts
Normal file
16
shared/draft-selection.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { datasetSchema, type DatasetManifest } from "./protocol";
|
||||
|
||||
export function selectDraftLocations(manifest: DatasetManifest, ids: string[]) {
|
||||
const available = manifest.availableViewpoints ?? manifest.viewpoints;
|
||||
const selected = new Set(ids);
|
||||
if (
|
||||
selected.size !== ids.length ||
|
||||
ids.some((id) => !available.some((p) => p.id === id))
|
||||
)
|
||||
throw new Error("Choose unique locations from this capture");
|
||||
return datasetSchema.parse({
|
||||
...manifest,
|
||||
availableViewpoints: available,
|
||||
viewpoints: available.filter((p) => selected.has(p.id)),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user