Skip to content

Add an in-place screenshot markup tool to the browser pane - #6335

Merged
AmethystLiang merged 14 commits into
stablyai:mainfrom
1shiharat:feat/browser-screenshot-markup
Jul 15, 2026
Merged

AmethystLiang merged 14 commits into
stablyai:mainfrom
1shiharat:feat/browser-screenshot-markup

Conversation

@1shiharat

@1shiharat 1shiharat commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

What this adds

A screenshot-markup tool for the in-app browser pane. A new Draw button freezes the visible page into a still image and overlays a drawing surface for pen, highlighter, arrow, rectangle, ellipse, and text (color, thickness, font size, undo/redo, plus a select tool to move/restyle/re-edit shapes). Copy markup then puts the annotated PNG on the clipboard to paste into your agent.

It's fully opt-in and additive — nothing changes unless you click the new button, and no existing flow is touched.

Why

When steering an agent against a live page, "make this look like X" is far faster to express by drawing on a screenshot than by typing it out. This turns the browser pane's existing "grab element → feedback" idea into a freehand markup pass, delivered through the same clipboard path the terminal already uses for pasted screenshots — so it works for local and remote/SSH agents alike.

A note on scope (sorry for the surprise)

This is a sizable, unsolicited contribution and I didn't open an issue first — apologies for dropping it without a heads-up. It's deliberately self-contained (all renderer-side, new modules under browser-pane/markup/, one small wiring change in BrowserPane.tsx) and opt-in, so it should be low-risk to evaluate or set aside. I'm very happy to split it into smaller PRs, rework the UX, or close it if it doesn't fit the roadmap — just say the word.

How it works

  • The drawing layer is a renderer-side <canvas> overlay — it never touches the page. Only the base image is environment-specific: local panes use webview.capturePage(), remote panes snapshot the displayed screencast <img>. Compose + delivery are shared.
  • The composite is always a PNG within the clipboard handler's limits, copied via the existing clipboard:writeImage; pasting into the agent reuses Orca's clipboard-screenshot flow (which writes the temp file on the correct host for local or remote agents).
  • Drawing model, compositing, shape rendering, hit-testing, and text metrics are isolated, unit-tested modules; the editor logic is split into focused hooks.

Testing

  • Unit tests for the drawing model (incl. undo/redo snapshots), compositing budget, shape rendering, hit-testing, and text metrics.
  • pnpm lint, pnpm typecheck, and pnpm test pass locally.

Compatibility / review notes

  • Cross-platform (macOS/Linux/Windows): renderer/canvas only; no platform APIs or paths. Undo (Cmd/Ctrl+Z) is platform-guarded via navigator.userAgent.
  • Local / remote / SSH: environment-agnostic by design — only the base-image capture branches (local webview vs remote screencast frame); delivery reuses the terminal's existing local/remote clipboard-image path.
  • Agents / integrations / git providers: provider-neutral; only adds a renderer tool and reuses the clipboard.
  • Performance: the overlay mounts only while active; the frozen base image and canvases are released on exit. No new IPC, polling, or watchers.
  • Security: no new IPC surface; the composite goes through the existing, size-limited PNG-only clipboard:writeImage handler.
  • UI quality: shadcn primitives + design tokens; verified across the draw/select/edit flows in light and dark.

Screenshots

screenshot 2026-06-25 at 15 42 35 screenshot 2026-06-25 at 15 43 12 screenshot 2026-06-25 at 15 43 39 screenshot 2026-06-25 at 15 43 47

X: @1shiharat

@1shiharat
1shiharat marked this pull request as ready for review June 25, 2026 07:05
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 051527a2-63a0-4537-81e6-9f90e6c1529d

📥 Commits

Reviewing files that changed from the base of the PR and between 8eec63f673a4d63bc85ebc5666e10c11c7168610 and 397d6ca8e25d7695d4bfe74d6dce25b7992d9761.

📒 Files selected for processing (10)
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.test.ts
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupEditor.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupMode.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
✅ Files skipped from review due to trivial changes (3)
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.ts
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.test.ts
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/browser-pane/markup/useMarkupEditor.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupMode.ts

📝 Walkthrough

Walkthrough

BrowserPane now supports markup drawing in both remote and local panes. The change adds shared markup components, a markup editor hook, screenshot capture and composition utilities, hit-testing and rendering helpers, and new locale strings for the markup UI. It also wires the new flow into the browser pane toolbar and pane content for both remote and local views.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.87% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an in-place screenshot markup tool to the browser pane.
Description check ✅ Passed The description is mostly complete: it covers summary, screenshots, testing, and compatibility notes, though the AI Review Report and Security Audit sections are not explicit.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
src/renderer/src/components/browser-pane/markup/markup-hit-test.test.ts (1)

16-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a highlight hit-test case matching rendered width.

Please add a test asserting highlight selection uses the widened highlight stroke semantics, so this path is regression-protected.

src/renderer/src/components/browser-pane/markup/markup-canvas-render.ts (1)

27-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a shared UI token for the selection outline.

Line 30 hard-codes #3b82f6, which makes the canvas overlay bypass the renderer theme/token system. Please resolve this from an existing token/CSS variable instead of introducing a new color literal here.

As per coding guidelines, “Never invent new color values...” and “All UI work ... must follow docs/STYLEGUIDE.md and use tokens defined in src/renderer/src/assets/main.css.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0f19723d-9ec7-4b89-8a0f-8881681c24aa

📥 Commits

Reviewing files that changed from the base of the PR and between 151cc05 and 8eec63f673a4d63bc85ebc5666e10c11c7168610.

📒 Files selected for processing (25)
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/browser-pane/markup/MarkupDrawButton.tsx
  • src/renderer/src/components/browser-pane/markup/MarkupOverlay.tsx
  • src/renderer/src/components/browser-pane/markup/MarkupToolbar.tsx
  • src/renderer/src/components/browser-pane/markup/markup-base-image.ts
  • src/renderer/src/components/browser-pane/markup/markup-canvas-render.ts
  • src/renderer/src/components/browser-pane/markup/markup-clipboard-delivery.ts
  • src/renderer/src/components/browser-pane/markup/markup-drawing-model.test.ts
  • src/renderer/src/components/browser-pane/markup/markup-drawing-model.ts
  • src/renderer/src/components/browser-pane/markup/markup-editor-document.ts
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.test.ts
  • src/renderer/src/components/browser-pane/markup/markup-hit-test.ts
  • src/renderer/src/components/browser-pane/markup/markup-screenshot-compose.test.ts
  • src/renderer/src/components/browser-pane/markup/markup-screenshot-compose.ts
  • src/renderer/src/components/browser-pane/markup/markup-shape-render.test.ts
  • src/renderer/src/components/browser-pane/markup/markup-shape-render.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupEditor.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupKeyboardShortcuts.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupMode.ts
  • src/renderer/src/components/browser-pane/markup/useMarkupPointerHandlers.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AmethystLiang

Copy link
Copy Markdown
Contributor

reviewing

1shiharat and others added 9 commits July 13, 2026 15:58
Adds a Draw button to the browser toolbar (local and remote/SSH panes) that
freezes the visible viewport into a still image and overlays a drawing canvas.
Users can mark it up with pen, highlighter, arrow, rectangle, ellipse, and text
(color, thickness, undo/redo), then copy the composited PNG to the clipboard to
paste into their agent — reusing the existing clipboard screenshot path, so it
works for local and remote agents alike.

The drawing layer is a renderer-side canvas, so the base image is the only
environment-specific piece: local panes use webview.capturePage(), remote panes
snapshot the already-displayed screencast frame. Drawing model, compositing, and
shape rendering are isolated, unit-tested modules.
- Copy now always produces a PNG (the clipboard handler accepts PNG only;
  a JPEG fallback silently produced an empty clipboard) and targets the
  clipboard size limit so realistic viewports stay full-resolution.
- Flatten the captured base image onto opaque white so transparent page
  backgrounds no longer ghost the live view through the frozen backdrop.
- Keep markup text-input keystrokes local (focus the field explicitly and
  stop propagation) so the browser pane's global handlers can't swallow them.
- Make the Draw toolbar button toggle markup mode off on a second click.
- Add a font-size control (text tool) to the markup toolbar.
- Add a Select tool to re-edit committed shapes: click to select, drag to
  move, change color/width/font-size of the selection, Delete to remove, and
  double-click text to re-edit its content. Undo/redo now snapshots the whole
  shape list so every edit (not just adding) is reversible.
- Fix the text input: transparent ink-colored field (no dark theme box over the
  screenshot) and ignore Enter during IME composition so Japanese conversion no
  longer commits the annotation early.
- Split the grown overlay logic into focused modules (editor hook, pointer +
  keyboard hooks, canvas renderer, document edits, hit-testing) to stay within
  the file-size budget.
- Clicking elsewhere while a text box is open now commits the text and
  switches to the Select tool, instead of discarding it (the input
  unmounted before its blur fired) and opening a new box at the click.
- Move the drawing toolbar to the bottom (stacked above the actions bar)
  and open the color/size popover upward.
- Hide the text shape being re-edited from the canvas so the live input
  isn't doubled by its committed render.
- Drop the input's padding/border and use the same font as the canvas so
  the typing preview sits exactly where the text renders (no shift);
  field-sizing keeps the box hugging the text.
- Estimate text width with full-width (CJK) awareness so the selection box
  and hit bounds track Japanese text instead of clipping it.
- Move the font-size control out of the color popover into its own toolbar
  button showing the current size.
Draw the selection box on the canvas even while a text shape is being
re-edited (the shape stays hidden so it isn't doubled), and strip the box
off the text input so it renders only the editable glyphs. The frame is now
identical whether selecting or editing, and the text overlays the same
position with the same font, so there's no shift between the two.
Force the text input's line-height to 1 and zero its height/padding so its
top edge matches the canvas textBaseline:'top' render — the editing text no
longer sits slightly lower than the committed/selected text.
- Hit-test highlights against their rendered (4x) thickness so the select
  tool doesn't miss large highlight strokes.
- Reset transient editor state (pending text, selection, in-progress drag) on
  Clear all so a pending input blur can't re-add text and no stale selection
  lingers over the emptied canvas.
- Guard markup completion with the capture token so a stale onDeliver can't
  reset or error a session the user already cancelled or restarted.
- Skip the grab-element keyboard shortcut while the markup overlay is open,
  matching the already-disabled grab toolbar buttons.
- Localize the markup error messages and surface them via a toast (the
  controller's error was otherwise never shown).
Reshape the screenshot-markup overlay to match its actual use — a throwaway
scribble the user copies once into their agent — and drop the re-editable
vector-editor machinery that made it an outlier in scope.

- Remove the select/move/restyle/re-edit subsystem: hit-testing, per-shape
  document edits, drag preview, selection frame, double-click text re-edit,
  Delete-to-remove, and the CJK text-width heuristic / multi-line text plumbing
  that only fed selection bounds. Keep pen, highlighter, arrow, rect, ellipse,
  and text with color/thickness/font-size and undo/redo/clear.
- Fix silent data loss on HiDPI: the compositor budgeted only bytes, so a large
  Retina viewport could produce a PNG under the byte limit but over the
  clipboard handler's pixel ceiling, which the handler drops silently while the
  UI still reported success. Composite now scales down to fit maxPixels too.
- Fix a stranded UI after a capture failure: the controller stayed "active" with
  no overlay and an inert Escape. It now returns to idle (capture failure) or
  back to the drawing surface (compose failure) after the error toast.

Net ~660 fewer lines and 3 fewer modules; delivery (freeze → composite PNG →
existing clipboard-image paste) is unchanged. Unit tests updated.
@AmethystLiang
AmethystLiang force-pushed the feat/browser-screenshot-markup branch from 397d6ca to d3637c8 Compare July 14, 2026 04:43
Highlight the new screenshot-markup Draw button the first time it's usable so
users — including existing ones — notice the tool. A localStorage-gated,
show-once tooltip + highlight ring, independent of the browser contextual tour
(which is capped at three steps and only shows to users who haven't seen it).

- New use-markup-draw-hint hook: opens once per install when the button is
  enabled and idle, auto-dismisses, and dismisses on click; skips cleanly when
  storage is unavailable.
- MarkupDrawButton forces its tooltip open with the discovery copy and rings the
  button while the hint shows.
- Localize the hint (drawHint) across en/es/ja/ko/zh; normalize the markup key
  order alphabetically.
The browser pane's two image-copy actions read inconsistently in English —
"Copy Screenshot" (the grab flow) vs "Copy markup" (the overlay). Match the new
markup button to the existing one: "Copy Markup". English only; other locales
already use their own sentence-case convention consistently, so they're
unchanged.
The one-time Draw-button hint no longer auto-dismisses on a timer the user might
miss. It now stays open until the user clicks Draw or the button stops being
usable (grab started, markup open, or a blank tab), which also fixes a case
where losing eligibility mid-hint left the forced-open tooltip stuck over a
disabled button.
Performance:
- Rasterize committed shapes once into an offscreen layer; per-frame paint blits
  that layer and draws only the in-progress shape, so a fast pointermove stream
  never re-strokes the whole scene.
- Encode the composite PNG off the main thread via canvas.toBlob (a large
  synchronous toDataURL froze the renderer), with a rAF yield so the "composing"
  UI paints first.

Correctness / review fixes:
- Don't overwrite the clipboard after cancel: re-check the capture token between
  the (now async) compose and onDeliver, closing the window where Escape during
  composing still delivered the markup.
- Keep the offscreen layer and visible canvas in lockstep by threading one
  measured devicePixelRatio through both paints, and re-measure on window resize
  so a monitor move (dpr change without a CSS-box change) repaints at the new
  scale. Blit stretched to the canvas box so a transient mismatch never clips.
- Drop the stale "or JPEG fallback" note; compose is PNG-only.
The old 3840×2160×dpr2 fixture (33.2M px) was already under the 32×1024×1024
(~33.55M) ceiling, so the "never over budget" assertions weren't exercising
the clamp path. Switch to 4000×3000×dpr2 (48M px), which genuinely exceeds
the ceiling.
@AmethystLiang
AmethystLiang merged commit 6ee2af3 into stablyai:main Jul 15, 2026
1 check passed
AmethystLiang pushed a commit that referenced this pull request Jul 15, 2026
Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.
AmethystLiang added a commit that referenced this pull request Jul 15, 2026
* fix: address pr-bug-scan validated finding from #6335

Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.

* fix(review): cover markup crypto fallback call sites with regression tests

PR #8804 replaced two unguarded crypto.randomUUID() calls with
createBrowserUuid(), matching the convention established in #5471, but
shipped without extending that PR's regression-test pattern to the new
call sites. Add hook-level tests for useMarkupPointerHandlers.onPointerDown
and useMarkupEditor.commitPendingText under a simulated non-secure-context
crypto global.

Co-authored-by: Orca <[email protected]>

* fix(review): consolidate annotation bridge token onto createBrowserUuid

BrowserPane had its own inline crypto.randomUUID guard with a
Date.now()+Math.random() fallback, duplicating the getRandomValues-based
fallback already centralized in createBrowserUuid() and used at every
other call site in the renderer.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…6335)

* Add in-place screenshot markup for the browser pane

Adds a Draw button to the browser toolbar (local and remote/SSH panes) that
freezes the visible viewport into a still image and overlays a drawing canvas.
Users can mark it up with pen, highlighter, arrow, rectangle, ellipse, and text
(color, thickness, undo/redo), then copy the composited PNG to the clipboard to
paste into their agent — reusing the existing clipboard screenshot path, so it
works for local and remote agents alike.

The drawing layer is a renderer-side canvas, so the base image is the only
environment-specific piece: local panes use webview.capturePage(), remote panes
snapshot the already-displayed screencast frame. Drawing model, compositing, and
shape rendering are isolated, unit-tested modules.

* Fix browser markup clipboard, transparency, text input, and toggle

- Copy now always produces a PNG (the clipboard handler accepts PNG only;
  a JPEG fallback silently produced an empty clipboard) and targets the
  clipboard size limit so realistic viewports stay full-resolution.
- Flatten the captured base image onto opaque white so transparent page
  backgrounds no longer ghost the live view through the frozen backdrop.
- Keep markup text-input keystrokes local (focus the field explicitly and
  stop propagation) so the browser pane's global handlers can't swallow them.
- Make the Draw toolbar button toggle markup mode off on a second click.

* Add markup text sizing, object re-editing, and text-input fixes

- Add a font-size control (text tool) to the markup toolbar.
- Add a Select tool to re-edit committed shapes: click to select, drag to
  move, change color/width/font-size of the selection, Delete to remove, and
  double-click text to re-edit its content. Undo/redo now snapshots the whole
  shape list so every edit (not just adding) is reversible.
- Fix the text input: transparent ink-colored field (no dark theme box over the
  screenshot) and ignore Enter during IME composition so Japanese conversion no
  longer commits the annotation early.
- Split the grown overlay logic into focused modules (editor hook, pointer +
  keyboard hooks, canvas renderer, document edits, hit-testing) to stay within
  the file-size budget.

* Improve markup text commit and move toolbar to the bottom

- Clicking elsewhere while a text box is open now commits the text and
  switches to the Select tool, instead of discarding it (the input
  unmounted before its blur fired) and opening a new box at the click.
- Move the drawing toolbar to the bottom (stacked above the actions bar)
  and open the color/size popover upward.

* Fix markup text re-editing alignment, doubling, and selection bounds

- Hide the text shape being re-edited from the canvas so the live input
  isn't doubled by its committed render.
- Drop the input's padding/border and use the same font as the canvas so
  the typing preview sits exactly where the text renders (no shift);
  field-sizing keeps the box hugging the text.
- Estimate text width with full-width (CJK) awareness so the selection box
  and hit bounds track Japanese text instead of clipping it.
- Move the font-size control out of the color popover into its own toolbar
  button showing the current size.

* Unify markup text selection and edit framing

Draw the selection box on the canvas even while a text shape is being
re-edited (the shape stays hidden so it isn't doubled), and strip the box
off the text input so it renders only the editable glyphs. The frame is now
identical whether selecting or editing, and the text overlays the same
position with the same font, so there's no shift between the two.

* Align markup text-edit baseline with the committed render

Force the text input's line-height to 1 and zero its height/padding so its
top edge matches the canvas textBaseline:'top' render — the editing text no
longer sits slightly lower than the committed/selected text.

* Address review: markup hit-testing, clear reset, and async guards

- Hit-test highlights against their rendered (4x) thickness so the select
  tool doesn't miss large highlight strokes.
- Reset transient editor state (pending text, selection, in-progress drag) on
  Clear all so a pending input blur can't re-add text and no stale selection
  lingers over the emptied canvas.
- Guard markup completion with the capture token so a stale onDeliver can't
  reset or error a session the user already cancelled or restarted.
- Skip the grab-element keyboard shortcut while the markup overlay is open,
  matching the already-disabled grab toolbar buttons.
- Localize the markup error messages and surface them via a toast (the
  controller's error was otherwise never shown).

* Trim browser markup to a draw-only tool and fix two delivery bugs

Reshape the screenshot-markup overlay to match its actual use — a throwaway
scribble the user copies once into their agent — and drop the re-editable
vector-editor machinery that made it an outlier in scope.

- Remove the select/move/restyle/re-edit subsystem: hit-testing, per-shape
  document edits, drag preview, selection frame, double-click text re-edit,
  Delete-to-remove, and the CJK text-width heuristic / multi-line text plumbing
  that only fed selection bounds. Keep pen, highlighter, arrow, rect, ellipse,
  and text with color/thickness/font-size and undo/redo/clear.
- Fix silent data loss on HiDPI: the compositor budgeted only bytes, so a large
  Retina viewport could produce a PNG under the byte limit but over the
  clipboard handler's pixel ceiling, which the handler drops silently while the
  UI still reported success. Composite now scales down to fit maxPixels too.
- Fix a stranded UI after a capture failure: the controller stayed "active" with
  no overlay and an inert Escape. It now returns to idle (capture failure) or
  back to the drawing surface (compose failure) after the error toast.

Net ~660 fewer lines and 3 fewer modules; delivery (freeze → composite PNG →
existing clipboard-image paste) is unchanged. Unit tests updated.

* Add a one-time discovery hint for the browser Draw button

Highlight the new screenshot-markup Draw button the first time it's usable so
users — including existing ones — notice the tool. A localStorage-gated,
show-once tooltip + highlight ring, independent of the browser contextual tour
(which is capped at three steps and only shows to users who haven't seen it).

- New use-markup-draw-hint hook: opens once per install when the button is
  enabled and idle, auto-dismisses, and dismisses on click; skips cleanly when
  storage is unavailable.
- MarkupDrawButton forces its tooltip open with the discovery copy and rings the
  button while the hint shows.
- Localize the hint (drawHint) across en/es/ja/ko/zh; normalize the markup key
  order alphabetically.

* Align the markup copy button label with "Copy Screenshot"

The browser pane's two image-copy actions read inconsistently in English —
"Copy Screenshot" (the grab flow) vs "Copy markup" (the overlay). Match the new
markup button to the existing one: "Copy Markup". English only; other locales
already use their own sentence-case convention consistently, so they're
unchanged.

* Drop the markup Draw hint auto-timeout; dismiss on act only

The one-time Draw-button hint no longer auto-dismisses on a timer the user might
miss. It now stays open until the user clicks Draw or the button stops being
usable (grab started, markup open, or a blank tab), which also fixes a case
where losing eligibility mid-hint left the forced-open tooltip stuck over a
disabled button.

* Optimize markup rendering and harden compose delivery

Performance:
- Rasterize committed shapes once into an offscreen layer; per-frame paint blits
  that layer and draws only the in-progress shape, so a fast pointermove stream
  never re-strokes the whole scene.
- Encode the composite PNG off the main thread via canvas.toBlob (a large
  synchronous toDataURL froze the renderer), with a rAF yield so the "composing"
  UI paints first.

Correctness / review fixes:
- Don't overwrite the clipboard after cancel: re-check the capture token between
  the (now async) compose and onDeliver, closing the window where Escape during
  composing still delivered the markup.
- Keep the offscreen layer and visible canvas in lockstep by threading one
  measured devicePixelRatio through both paints, and re-measure on window resize
  so a monitor move (dpr change without a CSS-box change) repaints at the new
  scale. Blit stretched to the canvas box so a transient mismatch never clips.
- Drop the stale "or JPEG fallback" note; compose is PNG-only.

* Fix test fixtures for markup pixel-budget clamping to use a truly oversi

The old 3840×2160×dpr2 fixture (33.2M px) was already under the 32×1024×1024
(~33.55M) ceiling, so the "never over budget" assertions weren't exercising
the clamp path. Switch to 4000×3000×dpr2 (48M px), which genuinely exceeds
the ceiling.

---------

Co-authored-by: Jinjing <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix: address pr-bug-scan validated finding from stablyai#6335

Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.

* fix(review): cover markup crypto fallback call sites with regression tests

PR stablyai#8804 replaced two unguarded crypto.randomUUID() calls with
createBrowserUuid(), matching the convention established in stablyai#5471, but
shipped without extending that PR's regression-test pattern to the new
call sites. Add hook-level tests for useMarkupPointerHandlers.onPointerDown
and useMarkupEditor.commitPendingText under a simulated non-secure-context
crypto global.

Co-authored-by: Orca <[email protected]>

* fix(review): consolidate annotation bridge token onto createBrowserUuid

BrowserPane had its own inline crypto.randomUUID guard with a
Date.now()+Math.random() fallback, duplicating the getRandomValues-based
fallback already centralized in createBrowserUuid() and used at every
other call site in the renderer.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

3 participants