Add lasso selection and pasted images
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
This commit is contained in:
parent
894291df7f
commit
84b9d4469f
26 changed files with 1274 additions and 39 deletions
|
|
@ -7,7 +7,7 @@ Lecture notes as a tree of pages ("comb") — live-preview markdown underneath,
|
|||
```sh
|
||||
npm install
|
||||
npm run dev # http://localhost:5173
|
||||
npm test # unit tests (tree, markdown, PDF round trip, sync against a fake GitHub)
|
||||
npm test # unit tests (tree, markdown, selection, PDF round trip, sync against a fake GitHub)
|
||||
npm run check # type-check
|
||||
npm run build # static PWA in build/ — serve it from any static host (HTTPS for PWA install)
|
||||
```
|
||||
|
|
@ -22,7 +22,9 @@ The image builds the PWA and serves it with nginx. Put an HTTPS reverse proxy in
|
|||
|
||||
## Using it
|
||||
|
||||
- **Tools** (bottom bar): Text `T`, Pen `P`, Highlighter `H`, Eraser `E`, Import PDF, Undo/Redo, zoom. The pen's eraser end erases too.
|
||||
- **Tools** (bottom bar): Text `T`, Select `S`, Pen `P`, Highlighter `H`, Eraser `E`, Import PDF, Insert image, Undo/Redo, zoom. The pen's eraser end erases too.
|
||||
- **Selecting**: with Select, draw a loop around ink and images (only things entirely inside are picked) or tap one. Holding the pen's side button lassoes with any tool. Drag the box to move, a corner to resize; the bar above it copies, cuts, duplicates, deletes or recolours. `Ctrl+C/X/V/D`, `Delete` and arrow keys work too.
|
||||
- **Images**: paste (`Ctrl+V`), drop an image file on a page, or use Insert image. Large images are scaled down to 2400 px. Images stay in their own colours in dark mode. Copying a selection also puts a PNG of it on the system clipboard.
|
||||
- **Pages**: the "+" circles beside the active page add a page there (a quick finger flick toward a free side offers one there; turn it off under Settings → Pen & touch); `Alt+Arrow` moves to (or creates) the neighbour. Right-click a page or use its `⋯` button to insert, resize or delete it.
|
||||
- **Grid**: the faint background grid has one cell per active page; Settings → Appearance can hide it or subdivide it.
|
||||
- **Importing a PDF** into a non-empty canvas shows every free spot; click one to place the chain. Into a blank canvas it simply replaces the empty page. The Files panel can also import a PDF as a new canvas.
|
||||
|
|
@ -34,7 +36,8 @@ The image builds the PWA and serves it with nginx. Put an HTTPS reverse proxy in
|
|||
- `src/lib/model` — page tree (pure functions: insert/remove/flatten/layout).
|
||||
- `src/lib/editor` — markdown analysis shared by the CodeMirror live preview and the PDF text layout.
|
||||
- `src/lib/pdf` — PDF writer (vector text, Ink annotations, embedded source-of-truth files) and reader.
|
||||
- `src/lib/ink` — stroke recording/outlines and palm rejection (ported from `palm-rejection-test.html`).
|
||||
- `src/lib/ink` — stroke recording/outlines, lasso selection and clipboard helpers, palm rejection (ported from `palm-rejection-test.html`).
|
||||
- `src/lib/images` — pasted-image normalisation, asset storage/object URLs, PNG export of a selection.
|
||||
- `src/lib/storage`, `src/lib/sync` — IndexedDB vault and GitHub sync.
|
||||
|
||||
Fonts in `static/fonts` are pre-subset (`scripts/subset-fonts.sh`) because pdf-lib's own subsetter drops glyphs.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue