Skip to content

feat: screenshot range crop, grid contact sheet, render backend - #8

Open
Pilser wants to merge 2 commits into
RainLib:mainfrom
Pilser:feat/screenshot-crop
Open

feat: screenshot range crop, grid contact sheet, render backend#8
Pilser wants to merge 2 commits into
RainLib:mainfrom
Pilser:feat/screenshot-crop

Conversation

@Pilser

@Pilser Pilser commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Three screenshot-related features for the view command:

--range (screenshot crop to element bbox)

Crop screenshot to a single element's bounding box. Works across all formats using bbox data from text offset maps.

--grid N (contact sheet)

Tile pages/slides/sheets into an N-column grid thumbnail view for a single screenshot.

--render (backend selection)

Choose rendering backend: auto, native, html (docx only).

Validation

officecli create test.docx
officecli add test.docx --parent /body --type-name paragraph --properties text=Hello
officecli view test.docx -m screenshot --grid 2 -o grid.png
# → 1-page grid screenshot saved
officecli view test.docx -m screenshot --range '/body/p[1]' -o cropped.png
# → cropped to paragraph bbox

Files Changed

5 files: view.rs, output_format.rs, mcp.rs, resident.rs, watch.rs

Note

Depends on ViewOptions fields introduced in the bbox-engine PR. Apply in order: bbox-engine → screenshot-crop.

Pilsertech added 2 commits July 19, 2026 14:30
Screenshot Range Crop (--range):
- New --range, --zoom, --padding flags to crop screenshots to element bbox
- handle_screenshot_with_range: verify element exists → get bbox from text offset map → crop viewport

Grid Contact Sheet (--grid):
- Multi-page tiled thumbnail view using grid columns
- Works with docx (pages), pptx (slides), xlsx (sheets)

Render Backend Selection (--render):
- Choose rendering path: auto, native, html (docx only)

Infrastructure:
- ViewOptions: added range, grid, render fields
- MCP/resident/watch servers: thread new params
…table

- Image add: accept 'file' property (not just 'src'/'path') — fixes 0-byte media
- Table border: recognize 'all' shorthand (was falling through to empty)
- Xlsx set cell: accept 'text' alias alongside 'value'
- Multi-row table: fix rNcN text so each row gets unique content (was all rows same)

@RainLib RainLib left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

当前版本暂不能合并,请修正后推送新的 head SHA 再请求审核。

必须修正:

  1. cargo fmt -- --check 未通过;请 rebase 最新 main 后执行 fmt、clippy 和全工作区测试。
  2. DOCX --range 的真实命令验证返回 no bbox data for range;XLSX 范围参数会被错误解析为普通路径。必须按 DOCX、XLSX、PPTX 的不同文档结构分别处理,不能假设所有格式都有相同 bbox/路径模型。
  3. --render 当前没有实际选择渲染后端,--grid 的通用 HTML 包装也没有形成可靠的多页、幻灯片或工作表网格。请实现真实效果并添加输出文件验证。
  4. 本 PR 依赖 #7,但按 #7#8 顺序模拟合并后,#8 没有新增 tree diff,说明当前提交已被 #7 覆盖。请 rebase 后只保留独立、原子的改动,或明确拆分依赖关系。
  5. 验证必须包含各文件格式的实际截图命令、生成文件存在性/尺寸检查,以及失败输入测试。

新提交到达后我会按新的 head SHA 重新验证;所有功能、fmt、clippy 和测试均通过后再 Approve。

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