feat(web): complete user-facing workflow command coverage
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
import type { NonMeshFontLinksIR, SceneSnapshotIR, VFontResourceIR } from "../../../protocol/scene-ir";
|
||||
import type { StorageAssetPutResult, StorageAssetReadResult, StorageAssetRecord } from "../../../protocol/storage";
|
||||
import type { WebEngineEditCommand } from "../../../protocol/web-engine";
|
||||
import { nonMeshGeometryCommands } from "../../../protocol/nonmesh-geometry-commands";
|
||||
|
||||
export interface ExternalVFontStoragePort {
|
||||
putAsset(projectId: string, data: ArrayBuffer, mimeType: string, sourcePath?: string): Promise<StorageAssetPutResult>;
|
||||
@@ -74,7 +75,7 @@ export async function importExternalVFontIntoMain(options: ImportExternalVFontOp
|
||||
);
|
||||
const mainImport = createExternalVFontMainImport(validated, asset);
|
||||
const { data, ...proof } = mainImport;
|
||||
const applied = await options.engine.applyCommand({ type: "importVFont", ...proof, base64: encodeBase64(data) });
|
||||
const applied = await options.engine.applyCommand(nonMeshGeometryCommands.importVFont({ ...proof, base64: encodeBase64(data) }));
|
||||
const vfont = applied.snapshot.vfonts?.find((candidate) =>
|
||||
candidate.sourcePath === proof.sourcePath && candidate.name === proof.name && candidate.packed &&
|
||||
candidate.packedByteLength === proof.byteLength && candidate.sha256 === proof.sha256);
|
||||
@@ -118,7 +119,7 @@ export async function replaceExternalVFontStyleInMain(
|
||||
throw new ExternalVFontValidationError("NON_MESH_PROPERTY_INVALID", "font style already uses the requested VFont");
|
||||
}
|
||||
const links = { ...previousLinks, [options.style]: vfont.id };
|
||||
const applied = await options.engine.applyCommand({ type: "setFontLinks", dataId: data.id, links });
|
||||
const applied = await options.engine.applyCommand(nonMeshGeometryCommands.setFontLinks(data.id, links));
|
||||
const appliedData = applied.snapshot.nonMeshData?.find((candidate) => candidate.id === data.id);
|
||||
const appliedVFont = applied.snapshot.vfonts?.find((candidate) => candidate.id === vfont.id);
|
||||
if (!appliedData?.fontLinks || appliedData.fontLinks[options.style] !== vfont.id ||
|
||||
|
||||
Reference in New Issue
Block a user