From 26d208c719cda8b74ee52d6a9833ea4ef82f5bba Mon Sep 17 00:00:00 2001
From: Quang Tran <16215255+trmquang93@users.noreply.github.com>
Date: Mon, 13 Apr 2026 21:56:27 +0700
Subject: [PATCH] feat: copy screen(s) as PNG image to clipboard
Add "Copy as Image" option to the screen context menu that renders
one or more selected screens to a PNG and writes it to the system
clipboard via the Clipboard API. Multi-screen selections are composited
into a single image preserving their relative canvas positions.
---
src/components/CanvasArea.jsx | 34 ++++++++++
src/utils/copyAsImage.js | 113 ++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+)
create mode 100644 src/utils/copyAsImage.js
diff --git a/src/components/CanvasArea.jsx b/src/components/CanvasArea.jsx
index a5d9833..f59e13b 100644
--- a/src/components/CanvasArea.jsx
+++ b/src/components/CanvasArea.jsx
@@ -1,6 +1,7 @@
import { COLORS, FONTS, Z_INDEX } from "../styles/theme";
import { DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT } from "../constants";
import { copyScreenForFigma, copyScreensForFigma, copyScreensForFigmaEditable, downloadScreenSvg } from "../utils/copyToFigma";
+import { copyScreensAsImage } from "../utils/copyAsImage";
import { ScreenNode } from "./ScreenNode";
import { ConnectionLines } from "./ConnectionLines";
import { ConditionalPrompt } from "./ConditionalPrompt";
@@ -409,6 +410,39 @@ export function CanvasArea({