mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Fix #457: paste screenshots from the clipboard on macOS, Windows and the web
A screenshot on the clipboard didn't paste everywhere: - macOS: the Paste menu item (which takes Cmd+V there) was enabled for text only, so with nothing copied in the app Cmd+V did nothing; and arboard reads the pasteboard's TIFF only. The pasteboard's types now enable Paste, and its PNG, else TIFF, pastes as it is. - Windows: bitmaps came through CF_BITMAP and GetDIBits, which drops alpha. Paste now reads PNG, else CF_DIBV5, else CF_DIB, decoded with their colour masks and tables (a BMP file header in front, which image's headerless decoder gets wrong for masks after a BITMAPINFOHEADER), opaque when the alpha is zero throughout as screenshots leave it, capped at 32768 px a side. - Web: only SVG text pasted. The page's paste event now hands the first picture or file that is art to the app (VectorcraftApp::paste_from_host), pasted with the chord held, like the desktop's paste keys. - Linux reads image/png already; its Paste menu item still waits for text (no cheap way to ask arboard for a bitmap), the paste keys take one. Bitmaps paste as embedded images at the view centre, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f22c100cc5
commit
8f771faa9e
11 files changed
+351
-37
No files matched your search
@@ -304,8 +304,9 @@ the same); the last one runs the paste with `swatchConflict`. `ui.dialog.cancel`
|
||||
|
||||
Paste placement: through the app, `edit.paste` and `edit.pasteWithoutFormatting` without `center`, `dx` or `dy`
|
||||
paste at the centre of the view. The Paste menu items are enabled while the system clipboard holds something to
|
||||
paste (SVG, PDF, text or a bitmap on the desktop; SVG on the web), even with nothing copied in the app (looked at up
|
||||
to four times a second; `ui.menu.list` shows it). The Layers panel menu (≡ on
|
||||
paste (SVG, PDF, text or a bitmap on Windows; text or a bitmap on macOS; text on Linux, whose paste keys still take a
|
||||
bitmap; SVG on the web, whose paste keys also take pictures and files), even with nothing copied in the app (looked
|
||||
at up to four times a second; `ui.menu.list` shows it). The Layers panel menu (≡ on
|
||||
the dock's tab strip while Layers shows) lists the layer commands (New Layer…, Duplicate and Delete Selection,
|
||||
Options for Selection…, clipping mask, isolation, Locate Object, Merge Selected, Flatten Artwork, Collect in New
|
||||
Layer, Release to Layers, Reverse Order, Template, Hide/Outline/Lock Others or Show/Preview/Unlock All Layers), Paste
|
||||
@@ -346,7 +347,8 @@ System clipboard formats: through the desktop app, `edit.copy` and `edit.cut` pu
|
||||
lists to the system clipboard, and every Paste command first loads what another app copied (`clipboard.importSvg`,
|
||||
`importPdf`, `importText` or `importImage`, centred in the view); an import error answers the Paste with that error
|
||||
and pastes nothing. Cmd+V also pastes a bitmap or PDF with no text beside it (on the key's release, as egui sends no
|
||||
Paste event for it).
|
||||
Paste event for it). Screenshots paste on every platform: Windows reads `PNG`, else `CF_DIBV5`/`CF_DIB`, macOS the
|
||||
pasteboard's PNG or TIFF, Linux `image/png`, and the web the picture the browser's paste event carries (#457).
|
||||
|
||||
File menu details: `file.openRecent1`…`file.openRecent30` open the recent files the `recentFilesCount` preference
|
||||
lists (0 hides them all; `file.recentFiles` returns the listed paths), `file.reveal` shows the document's file in the
|
||||
|
||||
+5
-2
@@ -1479,8 +1479,11 @@ physical size) or `clipboard.importText {text}` (point text in the default type
|
||||
(default: the first artboard); then any `edit.paste*` command pastes it. The desktop app does this itself: Copy and
|
||||
Cut publish the formats to the system clipboard, and a Paste outside text editing first reads what another app
|
||||
copied (SVG, then PDF, then text, then a bitmap; SVG markup in text counts as SVG). Pasting what VectorCraft copied
|
||||
keeps the lossless internal clipboard. Windows carries every format both ways; macOS and Linux carry one format
|
||||
(the text, else the PNG) and paste text and bitmaps. On the web only SVG text goes through the system clipboard.
|
||||
keeps the lossless internal clipboard. Windows carries every format both ways and pastes a bitmap from PNG, else
|
||||
from the device-independent bitmap screenshots copy (`CF_DIBV5`, then `CF_DIB`; alpha kept, opaque when it is zero
|
||||
throughout, at most 32768 px a side); macOS and Linux carry one format (the text, else the PNG) and paste text and
|
||||
bitmaps (macOS the pasteboard's PNG, else TIFF, as screenshots copy them). On the web Copy publishes SVG text, and
|
||||
Paste takes SVG text and the pictures and files a paste carries (a screenshot pastes as an embedded image).
|
||||
|
||||
The `pasteTextFormatting` preference (`keep` or `plain`): with `plain`, text the Type tool copied pastes into type
|
||||
without its formatting, taking the style at the caret.
|
||||
|
||||
Reference in new issue
Block a user