mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 11:47:21 -06: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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f22c100cc5
commit
8f771faa9e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user