Files
image-workbench-desktop/src-tauri/tauri.conf.json
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

55 lines
1.8 KiB
JSON

{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.25.29",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
"beforeDevCommand": "npm run build",
"beforeBuildCommand": "npm run lint && npm run build && node scripts/strip-plugins.js"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"label": "main",
"title": "无限画布",
"width": 1440,
"height": 900,
"minWidth": 1024,
"minHeight": 640,
"resizable": true,
"fullscreen": false,
"center": true,
"dragDropEnabled": false
}
],
"security": {
"csp": "default-src 'self'; script-src 'self' blob:; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' ipc: http://ipc.localhost https: blob: data: http://127.0.0.1:30092 http://localhost:30092; object-src 'none'; base-uri 'none'; frame-ancestors 'none'"
}
},
"bundle": {
"active": true,
"targets": "all",
"category": "GraphicsAndDesign",
"shortDescription": "无限画布 · 生图工作台",
"longDescription": "节点式无限画布,本地编排与生成图片,支持系统原生另存为。",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"createUpdaterArtifacts": true
},
"plugins": {
"updater": {
"endpoints": [
"https://download.maqiart.eu.org/updates/latest.json"
],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE3QUU1N0QwQUM5RjE1RjEKUldUeEZaK3MwRmV1RnhjNVhhSlhaSHkvbVRXNDdscHpOa0s0VHF4NHBBQVJBdDQ0dEVlck5FeEsK"
}
}
}