Skip to content

feat: annotation styles, selectable text on pins, barcode recognition - #107

Merged
bitdan merged 7 commits into
masterfrom
feat/annotation-text-barcode
Nov 26, 2026
Merged

bitdan merged 7 commits into
masterfrom
feat/annotation-text-barcode

Conversation

@bitdan

@bitdan bitdan commented Nov 26, 2026

Copy link
Copy Markdown
Owner

What changed

Three roadmap features, each built on its own branch and merged here for one review.

Annotation styles (capture, pins and live annotation while recording)

  • Line style for rectangle, ellipse, line, polyline, arrow and pen: solid, dashed or dotted. Arrow heads stay solid.
  • Arrow and arrow-with-text: single or double-headed.
  • Rectangle and ellipse fill: none, semi-transparent or solid, in the stroke colour. Rectangles can have rounded corners.
  • Text: optional background box in the chosen colour (the text switches to black or white for contrast) and optional black/white outline whose width follows the stroke width.
  • Selecting an existing shape shows and edits its style, with undo. The new Annotation fields are #[serde(default)] and skipped when default, so old capture/pin history loads and saves unchanged. The live preview, exports, pins and the recording raster draw the same thing.

Select text on pins

  • T, the toolbar button or the context menu runs OCR with the configured engine and overlays a selectable text layer. Drag, double/triple-click (word/line), Shift+click, Ctrl/⌘+A, Ctrl/⌘+C (reading order, line breaks kept; copies the image when nothing is selected), H turns the selection into highlighter annotations, Esc leaves.
  • The result is cached per image and redone after rotate/flip/grayscale/invert/reset. It needs an engine that returns line boxes (PP-OCR, Windows OCR / Apple Vision, WeChat OCR); online engines show a short message. Characters inside a line are estimated from glyph widths.
  • Geometry, hit-testing and text assembly are in snap_core::recognition::text_layer with unit tests.

Barcodes and 2D codes

  • rqrr is replaced by rxing (Apache-2.0): QR / Micro QR, Data Matrix, Aztec, PDF417 and Code 128, Code 39, Code 93, Codabar, EAN-13/8, UPC-A/E, ITF, GS1 DataBar. Every code in the image is listed top-to-bottom with its format and content, each with its own copy button. URLs still need confirmation before opening.
  • recognition/qr.rs became recognition/codes.rs; labels read "二维码 / 条形码" where it fits.

Docs (capture.md, ocr.md, pin.md, shortcuts.md, guide index), READMEs, TECHNICAL.md, English strings and the TODO table are updated.

Why

The owner picked these from the roadmap: annotation styles are free in PixPin and paid in Snipaste, selectable text on pins is PixPin's signature feature, and barcode recognition is paid in both while costing little here.

Notes for review

  • Merging needed two small conflict resolutions (pin toolbar width in pins.rs, one English string) and one compile fix: the highlighter marks built by text_layer now set the new style fields.
  • Cargo.lock changes for rxing. Its effect on release size and compile time hasn't been measured yet.
  • cargo test -p snap-core -p snap-desk-gpui (404 + 64 passed) and node scripts/check-architecture.mjs pass. With the pre-existing while_immutable_condition error in scroll/recovery.rs allowed, Clippy reports nothing in the new code.
  • The owner tried all three features by hand in the Windows debug build.

🤖 Generated with Claude Code

bitdan and others added 7 commits November 26, 2026 14:44
…xt box and outline

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	apps/desktop-gpui/src/pins.rs
# Conflicts:
#	crates/snap-core/i18n/messages.en.json
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bitdan
bitdan merged commit cbb402e into master Nov 26, 2026
4 checks passed
@bitdan
bitdan deleted the feat/annotation-text-barcode branch November 26, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant