滚动截图,细节调整

This commit is contained in:
zhongluofeng
2026-09-04 19:56:23 +08:00
parent 6b9f71da08
commit 27ad5d89a5
34 changed files with 3766 additions and 559 deletions
+33 -4
View File
@@ -280,10 +280,31 @@ export const commands = {
screenshotEnumWindows: () => __TAURI_INVOKE<WindowInfo[]>("screenshot_enum_windows"),
/** 按 hwnd 捕获指定窗口 */
screenshotCaptureWindow: (hwnd: number) => __TAURI_INVOKE<CaptureData>("screenshot_capture_window", { hwnd }),
/** 存入编辑器图片(base64 PNG */
screenshotSetEditorImage: (pngBase64: string) => __TAURI_INVOKE<null>("screenshot_set_editor_image", { pngBase64 }),
/** 取出编辑器图片(编辑器窗口加载时调用,取出即清除) */
screenshotGetEditorImage: () => __TAURI_INVOKE<string | null>("screenshot_get_editor_image"),
/**
* 滚动截图:从窗口当前滚动位置向下拼接到底部,返回超长 PNG。
* `region` 为 Some 时仅在框选区域(屏幕物理坐标)内捕捉,宽 = 选区宽;
* 为 None 时捕捉整个客户区。结束后会把窗口滚回起始位置,不打扰用户。
*/
screenshotScrollCapture: (hwnd: number, region: {
x: number,
y: number,
width: number,
height: number,
} | null) => __TAURI_INVOKE<CaptureData>("screenshot_scroll_capture", { hwnd, region }),
/** 取消滚动截图会话(不导出)。 */
screenshotScrollCancel: () => __TAURI_INVOKE<null>("screenshot_scroll_cancel"),
/** 结束滚动截图会话并导出结果。 */
screenshotScrollFinish: () => __TAURI_INVOKE<null>("screenshot_scroll_finish"),
/**
* 启动滚动截图会话(后台线程持续捕捉拼接,实时推进度事件)。
* `auto = true` 为自动滚动(线程主动下滚拼到底部);`false` 为手动(等用户滚动窗口)。
*/
screenshotScrollStart: (hwnd: number, region: {
x: number,
y: number,
width: number,
height: number,
} | null, auto: boolean) => __TAURI_INVOKE<null>("screenshot_scroll_start", { hwnd, region, auto }),
/** 将 PNG base64 写入系统剪贴板(转 CF_DIB */
screenshotCopyImage: (pngBase64: string) => __TAURI_INVOKE<null>("screenshot_copy_image", { pngBase64 }),
/** 将 PNG base64 写入文件 */
@@ -634,6 +655,14 @@ export type ScreenRect = {
height: number,
};
/** 滚动截图区域(屏幕物理像素坐标,通常为覆盖层框选区平移到屏幕) */
export type ScrollRegion = {
x: number,
y: number,
width: number,
height: number,
};
/** 下载分段(多线程 Range 下载 / 断点续传用) */
export type Segment = {
/** 分段索引 */
+16
View File
@@ -10,6 +10,10 @@ export const WINDOWS = {
osdOverlay: 'osd-overlay',
screenshotOverlay: 'screenshot-overlay',
screenshotPin: 'screenshot-pin',
/** 常驻截图编辑器窗口(隐藏复用,打开只 show 不重建 WebView */
screenshotEditor: 'screenshot-editor',
/** 滚动截图控制窗 */
screenshotScroll: 'screenshot-scroll',
/** 单文件一次性下载窗口前缀,实际 label = `${downloadWindow}-<taskId>` */
downloadWindow: 'download-window',
} as const
@@ -46,6 +50,18 @@ export const EVENTS = {
screenshotPinReady: 'screenshot-pin-ready',
screenshotPinShow: 'screenshot-pin-show',
screenshotExported: 'screenshot-exported',
/** 滚动截图会话:实时进度 { width, height, auto } */
scrollProgress: 'screenshot-scroll-progress',
/** 滚动截图会话:完成并导出(Rust 已把 PNG 原始字节写入编辑器图片槽,事件只带 { width, height } */
scrollComplete: 'screenshot-scroll-complete',
/** 滚动截图会话:已取消 */
scrollCancelled: 'screenshot-scroll-cancelled',
/** 滚动截图完成:打开截图编辑器(编辑/裁剪后保存才进历史) */
scrollToEditor: 'screenshot-scroll-to-editor',
/** 常驻编辑器窗口挂载完成(store 等待后下发加载事件) */
screenshotEditorReady: 'screenshot-editor-ready',
/** 通知常驻编辑器窗口加载编辑器图片槽中的新图(raw IPC 取出) */
screenshotEditorLoad: 'screenshot-editor-load',
// 内核安装进度
kernelInstallProgress: 'kernel-install-progress',
// 后端自动切换节点完成(后台执行,刷新节点列表并提示)