feat(canvas): add helpers to detect transparent clipboard nodes
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5024,6 +5024,21 @@ function canvasBackgroundStorageKey(projectId: string) {
|
|||||||
return `fluxo:canvas-background:${projectId}`;
|
return `fluxo:canvas-background:${projectId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isTransparentClipboardNode(node: CanvasNode) {
|
||||||
|
return node.type === "image" && (node.layerRole === "background-removed" || node.tone === "transparent-image");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function shouldUseInternalClipboardNode(node: CanvasNode, imageFiles: File[]) {
|
||||||
|
const imageFile = imageFiles[0];
|
||||||
|
if (!imageFile) return false;
|
||||||
|
try {
|
||||||
|
const dimensions = await readImageDimensions(imageFile);
|
||||||
|
return dimensions.width === Math.max(1, Math.round(node.width)) && dimensions.height === Math.max(1, Math.round(node.height));
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function writeCanvasNodeToSystemClipboard(node: CanvasNode) {
|
async function writeCanvasNodeToSystemClipboard(node: CanvasNode) {
|
||||||
if (node.type === "text") {
|
if (node.type === "text") {
|
||||||
await writeClipboardText(node.content || node.title);
|
await writeClipboardText(node.content || node.title);
|
||||||
|
|||||||
Reference in New Issue
Block a user