8e1506e4c4
Rasterize imported SVG/CAD sources to a transparent WebP render texture and carry it as an optional renderContent alongside the original content through the domain node, snapshot normalization, and reference images. Add canvasNodeRenderContent and prefer it for artboard, layer, generated-file, and project thumbnail previews while keeping content as the crop/download/ model-reference source. Generalize the SVG rasterizer with a render purpose and add upload/reference coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
905 B
JavaScript
27 lines
905 B
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { canvasNodeToReferenceImage } from "../src/ui/pages/CanvasWorkspace/canvas/nodeReferenceImages.ts";
|
|
|
|
test("keeps the SVG source for model preparation and uses WebP for the visible capsule", () => {
|
|
const reference = canvasNodeToReferenceImage({
|
|
id: "cad-1",
|
|
type: "image",
|
|
title: "drawing.svg",
|
|
x: 0,
|
|
y: 0,
|
|
width: 1200,
|
|
height: 800,
|
|
content: "https://assets.example/drawing.svg",
|
|
renderContent: "https://assets.example/drawing.render.webp",
|
|
tone: "transparent-image",
|
|
status: "success",
|
|
layerRole: "cad-vector",
|
|
semanticContext: "CAD context"
|
|
});
|
|
|
|
assert.equal(reference.publicUrl, "https://assets.example/drawing.svg");
|
|
assert.equal(reference.previewUrl, "https://assets.example/drawing.render.webp");
|
|
assert.equal(reference.semanticContext, "CAD context");
|
|
});
|