Files
image-workbench-desktop/src-tauri/Cargo.toml
T
qiqi 596d5fdf82 fix(canvas-webview): 网页压住地址栏(原生/ DOM 坐标原点差)、内容跟随画布缩放
用户反馈:地址栏和前进/后退/刷新按钮被网页盖住,只剩左上角一小块;
缩小画布后网页内容不跟着缩,反而按原宽度重排。

根因一:坐标原点差
  add_child / set_bounds 的 LogicalPosition 以**窗口边框**左上角为原点,
  而 getBoundingClientRect() 以**内容视图**左上角为原点 —— macOS 标准标题栏下差 32pt。
  于是每个画布网页整体上浮 32px,正好压住 34px 高的工具栏。
  最小 Tauri 工程实测:窗口 frame=1000x760、DOM innerHeight=728;子视图 y 传 200
  实际落在 168;把 y 改成 232 后红框精确落在内容原点+(300,200)。
  修法:新增 canvas_webview_metrics 回报窗口边框尺寸,渲染层用它减 window.innerHeight
  得到补偿值,推 rect 时加上(全屏时标题栏消失,差值自动回 0)。

根因二:页面 zoom 恒为 1
  rect 跟着画布缩,但页面缩放没变 ⇒ 视口变窄后网页重排,看起来「内容没缩小」。
  现在 zoom = 画布缩放 × 节点缩放(新命令参数 + Webview::set_zoom),
  网页像图片一样跟着画布一起缩放。

其它:
- 引擎把原生视图裁到「节点 ∩ 画布」,且上边界不越过工具栏底 —— 布局再变也压不住按钮
- 取消「选中时内缩 12px」:缩放手柄在节点外侧,本来就不用让位;点选不再让网页重排
- 尺寸推送从「只等静止」改为「静止优先 + 连续变化时每 120ms 跟一次」,缩放过程不脱节
- 暂停语义:插件写 data-iwb-cwv-paused,宿主关掉视图并保持关闭(✕ 才真的能关)
- 诊断:ensure/bounds 日志带上 off/zoom;page:started/finished 回传加载态与真实地址

版本 3.25.29
2026-11-19 07:13:51 +08:00

41 lines
1.4 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[package]
name = "image-workbench"
version = "3.25.29"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
repository = ""
edition = "2024"
rust-version = "1.90"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "image_workbench_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.7.4", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
# tray-icon:系统托盘(关闭窗口收进托盘而不是退出)
# tray-icon:系统托盘;image-png:托盘用单色 PNG 模板图标
# unstable:`Manager::get_window`(窗口级句柄,不受子 webview 影响)与 Window::add_child 都在它下面。
# 画布内嵌网页已下线(v3.25.27),但 get_window 仍要留着 —— save_geom/托盘/单实例都靠它,
# 且它比 get_webview_window 更稳(后者一旦窗口里有非同名 webview 就返回 None,见 v3.25.26)。
tauri = { version = "2.12.5", features = ["tray-icon", "image-png", "unstable"] }
url = "2"
tauri-plugin-log = "2"
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-http = "2"
tauri-plugin-updater = "2"
tauri-plugin-single-instance = "2"
tauri-plugin-notification = "2"
arboard = "3"
image = { version = "0.25", default-features = false, features = ["png"] }
base64 = "0.22"