Add lasso selection and pasted images #14

Merged
reudy merged 1 commit from select-and-images into main 2026-09-29 23:41:57 +02:00
Member

Adds a lasso Select tool and pasted images.

Selection

  • New Select tool (S): draw a loop around ink and images. Only things entirely inside get selected; tapping selects a single object. Shift adds to the selection, Ctrl+A selects the whole page.
  • Drag the box to move, a corner to resize (uniform; ink width scales too), arrow keys to nudge. The bar above the box has copy, cut, duplicate, delete and ink recolour. Ctrl+C/X/V/D and Delete work too; each change is one undo step.
  • Holding the pen's side button lassoes with any tool. It can be turned off under Settings → Pen & touch, and it doesn't open the context menu.
  • Copying also puts a PNG of the selection on the system clipboard. Pasting inside Papure uses the vector copy while it's fresh.

Images

  • Paste, drop a file on a page, the new Insert image toolbar button, or Paste in the page menu.
  • Capped at 2400 px on the long edge and stored as PNG (transparent) or JPEG (q 0.85), whichever fits. Stored once by content hash in a new IndexedDB assets store (DB version 2).
  • Drawn above the markdown and under the ink. The eraser doesn't touch images.
  • In the PDF, images are drawn on the visible page and saved as papure/pages/<id>.images.json + papure/assets/<hash>.png|jpg, each asset once. Older app versions can open these files but drop the images when they save.

Dark mode

Dark pages now invert each layer (PDF, text, ink) separately instead of the whole page, so images keep their real colours. The inverted ink layer is screen-blended so highlighted text stays bright. The page outline now uses the theme's own line colour.

Testing

  • npm test (50 tests, including new selection, clip and image round-trip tests), npm run check and npm run build pass.
  • Tested in headless Chromium: lasso, move, resize, duplicate, delete/undo, vector and image paste, layer order, dark-mode filters, pen-button lasso (simulated pen events), autosave, and the image in the downloaded PDF. No console errors.
  • Not tested on a real pen/tablet or in Safari/Firefox. Pen side-button events vary by device.

Design and follow-ups (drag across pages, rotate, crop, paste as new page) are in spec.md §10–11.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UcbKnqfprs8hMkTVsYx1dh

Adds a lasso **Select** tool and **pasted images**. ## Selection - New Select tool (`S`): draw a loop around ink and images. Only things entirely inside get selected; tapping selects a single object. Shift adds to the selection, `Ctrl+A` selects the whole page. - Drag the box to move, a corner to resize (uniform; ink width scales too), arrow keys to nudge. The bar above the box has copy, cut, duplicate, delete and ink recolour. `Ctrl+C/X/V/D` and `Delete` work too; each change is one undo step. - Holding the pen's side button lassoes with any tool. It can be turned off under Settings → Pen & touch, and it doesn't open the context menu. - Copying also puts a PNG of the selection on the system clipboard. Pasting inside Papure uses the vector copy while it's fresh. ## Images - Paste, drop a file on a page, the new **Insert image** toolbar button, or **Paste** in the page menu. - Capped at 2400 px on the long edge and stored as PNG (transparent) or JPEG (q 0.85), whichever fits. Stored once by content hash in a new IndexedDB `assets` store (DB version 2). - Drawn above the markdown and under the ink. The eraser doesn't touch images. - In the PDF, images are drawn on the visible page and saved as `papure/pages/<id>.images.json` + `papure/assets/<hash>.png|jpg`, each asset once. Older app versions can open these files but drop the images when they save. ## Dark mode Dark pages now invert each layer (PDF, text, ink) separately instead of the whole page, so images keep their real colours. The inverted ink layer is screen-blended so highlighted text stays bright. The page outline now uses the theme's own line colour. ## Testing - `npm test` (50 tests, including new selection, clip and image round-trip tests), `npm run check` and `npm run build` pass. - Tested in headless Chromium: lasso, move, resize, duplicate, delete/undo, vector and image paste, layer order, dark-mode filters, pen-button lasso (simulated pen events), autosave, and the image in the downloaded PDF. No console errors. - **Not tested** on a real pen/tablet or in Safari/Firefox. Pen side-button events vary by device. Design and follow-ups (drag across pages, rotate, crop, paste as new page) are in `spec.md` §10–11. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01UcbKnqfprs8hMkTVsYx1dh
agent added 1 commit 2026-09-29 23:05:15 +02:00
Select tool (S): lasso picks ink strokes and images that lie entirely
inside the loop, a tap picks one object. Move, uniform resize, nudge,
delete, recolour, copy/cut/paste/duplicate, each one undo step. Holding
the pen's barrel button lassoes with any tool (Settings > Pen & touch).
Copying also writes a PNG of the selection to the system clipboard.

Images come in by paste, drop, the Insert image button or the page menu.
They are capped at 2400 px, stored as PNG/JPEG by content hash in a new
IndexedDB store, drawn between the markdown and the ink, and written to
the PDF both visibly and as papure/assets + per-page images.json.

Dark pages now invert each layer except images, so images keep their
colours; the inverted ink layer is screen-blended so highlighted text
stays bright.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UcbKnqfprs8hMkTVsYx1dh
reudy merged commit 8a3d2224a7 into main 2026-09-29 23:41:57 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: reudy-net/Papure#14
No description provided.