Skip to content

feat(screenshot): add live preview panel for scroll capture - #3269

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
hthienloc:feat/screenshot-scroll-live-preview
Sep 3, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
hthienloc:feat/screenshot-scroll-live-preview

Conversation

@hthienloc

Copy link
Copy Markdown
Member

Ports the scrolling live preview panel feature from dms-quick-capture backend to the native DMS screenshot tool

recording_20260903_080418.mp4

- Port scrolling live preview from dms-quick-capture backend to native screenshot.
- Calculate dynamic preview panel geometry placed beside the capture hole on the side with most available space.
- Render downscaled live stitched canvas with dark translucent background and white border in drawScrollOverlay.
- Include preview panel in Wayland input regions and allow completing capture by clicking the preview panel.
- Update cursor shape to pointer hand when hovering over preview or control buttons.
- Add unit tests for layout, hit testing, and canvas rendering.
@hthienloc

Copy link
Copy Markdown
Member Author

/claude review

Comment thread core/internal/screenshot/scroll.go Resolved
@claude

claude Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Claude review

One finding — the feature works, but the preview stops rendering on long captures.

  • Panel aspect is derived from the full canvas, so it shrinks below minImageW and disappears once the stitch exceeds ~4.5× the selection width, core/internal/screenshot/scroll.go:270

Checked: preview geometry/clipping math, buffer indexing and format swap in drawScrollPreview, input-region and cursor changes for phaseScroll, bar/preview overlap layout, and the new test's assumptions. Model: claude-opus-5.

- Derive preview aspect ratio from a bounded tail window of the canvas (maxPreviewRows = frameW * maxHeight / minImageW).
- Prevent preview panel width from collapsing below minImageW and disappearing when stitched rows exceed ~4.5x width.
- Render the recent window rows in drawScrollPreview to maintain a stable panel size and display live incoming content.
- Add unit test for long scrolling capture preview bounds.
@hthienloc

Copy link
Copy Markdown
Member Author

/claude review

@claude

claude Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The previous finding (panel shrinking below minImageW and vanishing on long captures) is fixed by 87863250 — bounding previewRows to frameW * maxHeight / minImageW guarantees maxHeight * aspect >= minImageW, so the late imageWidth < minImageW bail is now unreachable and the panel settles at a stable size.

Checked this run: preview panel geometry (panelX/panelY stay on-screen and clear of the oversized hole, so overlay pixels cannot leak into the capture), the layout↔draw agreement on padding/imageW/imageH and the previewStartRow/previewRows window, canvas indexing against st.stride == frameW*4 plus the needSwap format handling, hasPreview guards on every consumer (scrollBarHit, layoutScrollBar, drawScrollPreview, setInputPassthrough), input-region and cursor behavior in phaseScroll, screenBuf lifetime for the new layoutScrollBar call path (set at setup, closed only at teardown — no nil deref), and the new tests' assumptions. Bar/preview overlap fallback is reachable in theory but not in practice: the bar only moves to y=24 when the hole covers the bottom, and a panel capped at maxImageH cannot reach both.

Model: claude-opus-5.

@bbedward
bbedward merged commit 99e2368 into duxlabs-dev:master Sep 3, 2026
3 checks passed
@hthienloc
hthienloc deleted the feat/screenshot-scroll-live-preview branch September 3, 2026 03:33
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.

2 participants