Skip to content

fix(macos): 添加标题栏拖拽区域 - #77

Open
Cateds wants to merge 1 commit into
std-microblock:masterfrom
Cateds:fix/macos-titlebar-drag-region
Open

Cateds wants to merge 1 commit into
std-microblock:masterfrom
Cateds:fix/macos-titlebar-drag-region

Conversation

@Cateds

@Cateds Cateds commented Sep 13, 2026

Copy link
Copy Markdown

问题

macOS 端使用 titleBarStyle: "Overlay" + hiddenTitle,网页内容铺满整个窗口;而前端唯一带 data-tauri-drag-regionWindowTitlebar 组件只在 Windows 渲染。结果是 macOS 上:

  • 窗口顶部没有任何可拖拽区域,窗口无法通过标题栏拖动;
  • 标题栏双击缩放同样不可用。

改动

  • src/celemod-ui/src/components/WindowTitlebar.tsx:macOS 分支渲染一个 32px 高的空条并标记 data-tauri-drag-region。拖动与双击缩放交给 Tauri 内置 drag 脚本处理(core:window:allow-start-dragging 已在 capabilities 中;双击使用的 internal_toggle_maximize 包含在 core:default 内)。
  • src/celemod-ui/src/index.scss:新增 .macos-titlebar(32px,与 tauri.macos.conf.jsontrafficLightPosition 的留白高度对应),并移除原来的 html[data-platform="macos"] .app-shell { padding-top: 32px; }。几何布局不变,只是把预留留白从 padding 换成真实的 flex 子元素。

验证

在真机 (MacBook Pro 16, MacOS 27 Beta 8) 上验证可以正常使用。

备注

双击缩放的动画期间,WebView 内容会出现旧画面拉伸/白边,这是 tao + WKWebView 的已知问题(tauri-apps/tauri#13898),与本次改动无关,上游修复见 tauri-apps/tao#1207

@Cateds Cateds closed this Sep 13, 2026
@Cateds Cateds reopened this Sep 13, 2026
@Cateds
Cateds marked this pull request as ready for review September 13, 2026 19:41
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.

1 participant