Open
Conversation
- 支持定点悬浮和跟随连接窗口两种模式 - 跟随模式支持左中/右上/右下/上中四种锚定位置 - 支持最置顶和连接窗口上一层两种层级模式 - 使用 DWM API 获取精确窗口边界,PhysicalPosition 处理 DPI 缩放 - 悬浮窗可拖拽、可缩放,关闭时保存尺寸 - 定点模式检测屏幕范围,防止悬浮窗在屏幕外 - 控制器未连接时不显示悬浮窗 - 主窗口关闭/最小化到托盘时自动关闭悬浮窗 - 支持中英文 i18n Co-authored-by: Cursor <cursoragent@cursor.com>
fa44620 to
b729be3
Compare
- 修复 macOS 构建:transparent() 仅在 Windows 上使用 - Cargo.toml 补全 Win32_Graphics_Dwm 和 Win32_UI_HiDpi features - 新增 set_connected_window_handle 命令,支持 ADB 手动指定跟随窗口 - LogsPanel 添加窗口选择器(ADB + 跟随模式时显示) - 「最置顶」改为「置顶」 - 补全 zh-TW、ja-JP、ko-KR 的日志悬浮窗 i18n Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
- 修复 DPI 缩放累积导致悬浮窗每次打开变大的问题 - 修复 popover 关闭时意外触发侧面板折叠(React Portal 事件冒泡) - 修复 popover 定位不正确和无法显示的问题 - 保存/恢复悬浮窗位置,启动时不再总是出现在左上角 - 将悬浮窗设置统一到 LogOverlayPopover 弹层 - 优化悬浮窗按钮视觉,增加状态指示 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Hey - 我发现了 1 个问题,并给出了一些高层次的反馈:
- 在
logOverlayService.clampToScreen中,你假设availableMonitors()返回的显示器位置/尺寸与浮层窗口处于同一个(物理)坐标空间,但 Tauri 的显示器 API 是感知逻辑 DPI 的,而你在其他地方则将坐标当作物理像素来处理;为避免在非 100% DPI 下错误地把窗口判定为在屏幕外,建议显式地将所有坐标统一到同一个空间(逻辑或物理)。 subscribeConnectionStatus这个 selector 在equalityFn中使用了JSON.stringify,这会在每次 store 变更时运行并产生新的字符串;你可以通过做一次更便宜的比较来降低开销(例如单独跟踪一个派生出来的hasAnyConnection布尔值和enabled标志),而不是序列化整个对象。
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `logOverlayService.clampToScreen` you assume monitor positions/sizes from `availableMonitors()` are in the same (physical) coordinate space as the overlay window, but Tauri monitor APIs are logical-DPI–aware while you otherwise treat coordinates as physical; consider explicitly normalizing everything to one space (logical or physical) to avoid misdetecting off-screen windows at non-100% DPI.
- The `subscribeConnectionStatus` selector uses `JSON.stringify` in `equalityFn`, which will run on every store change and allocate strings; you can reduce overhead by doing a cheap comparison (e.g. track a derived `hasAnyConnection` boolean and `enabled` flag) instead of serializing the whole object.
## Individual Comments
### Comment 1
<location> `src/components/LogOverlay.tsx:147-149` </location>
<code_context>
+ scrollbarColor: 'rgba(255,255,255,0.15) transparent',
+ }}
+ >
+ {logs.length === 0 ? (
+ <div className="h-full flex items-center justify-center text-white/25 text-[11px]">
+ 等待日志...
+ </div>
+ ) : (
</code_context>
<issue_to_address>
**suggestion:** 浮层中的空状态文案是硬编码的中文;建议使用 i18n 字符串以保持一致性。
由于其他界面文案已经使用了 i18n 系统,这个浮层也应该从翻译文件中读取占位文案,从而在不同语言环境下都能正常工作(或者至少提供英文回退文案)。
建议的实现方式:
```typescript
<div className="h-full flex items-center justify-center text-white/25 text-[11px]">
{t('logOverlay.waitingLogs', 'Waiting for logs...')}
</div>
```
要完整实现这项改动,你还需要:
1. 确保在 `src/components/LogOverlay.tsx` 顶部导入 `useTranslation`,例如:
- `import { useTranslation } from 'react-i18next';` 或者项目正在使用的其他 i18n 库的对应导入方式。
2. 在 `LogOverlay` 组件中初始化翻译 hook,使 `t` 可以在这段 JSX 中使用:
- 例如在组件内部:`const { t } = useTranslation();`,或带上合适的 namespace:`useTranslation('logOverlay');`。
3. 在你的翻译 JSON 文件中添加对应的 key,例如:
- 在 `en/logOverlay.json`(或对应的 namespace 文件)中:
`{ "waitingLogs": "Waiting for logs..." }`
- 如果需要,在中文翻译文件中:
`{ "waitingLogs": "等待日志..." }`
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据反馈改进后续的评审。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- In
logOverlayService.clampToScreenyou assume monitor positions/sizes fromavailableMonitors()are in the same (physical) coordinate space as the overlay window, but Tauri monitor APIs are logical-DPI–aware while you otherwise treat coordinates as physical; consider explicitly normalizing everything to one space (logical or physical) to avoid misdetecting off-screen windows at non-100% DPI. - The
subscribeConnectionStatusselector usesJSON.stringifyinequalityFn, which will run on every store change and allocate strings; you can reduce overhead by doing a cheap comparison (e.g. track a derivedhasAnyConnectionboolean andenabledflag) instead of serializing the whole object.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `logOverlayService.clampToScreen` you assume monitor positions/sizes from `availableMonitors()` are in the same (physical) coordinate space as the overlay window, but Tauri monitor APIs are logical-DPI–aware while you otherwise treat coordinates as physical; consider explicitly normalizing everything to one space (logical or physical) to avoid misdetecting off-screen windows at non-100% DPI.
- The `subscribeConnectionStatus` selector uses `JSON.stringify` in `equalityFn`, which will run on every store change and allocate strings; you can reduce overhead by doing a cheap comparison (e.g. track a derived `hasAnyConnection` boolean and `enabled` flag) instead of serializing the whole object.
## Individual Comments
### Comment 1
<location> `src/components/LogOverlay.tsx:147-149` </location>
<code_context>
+ scrollbarColor: 'rgba(255,255,255,0.15) transparent',
+ }}
+ >
+ {logs.length === 0 ? (
+ <div className="h-full flex items-center justify-center text-white/25 text-[11px]">
+ 等待日志...
+ </div>
+ ) : (
</code_context>
<issue_to_address>
**suggestion:** The empty-state text in the overlay is hardcoded Chinese; consider using i18n strings for consistency.
Since other UI text uses the i18n system, this overlay should also read its placeholder from the translation files so it works across locales (or at least use an English fallback).
Suggested implementation:
```typescript
<div className="h-full flex items-center justify-center text-white/25 text-[11px]">
{t('logOverlay.waitingLogs', 'Waiting for logs...')}
</div>
```
To fully implement this change, you will also need to:
1. Ensure `useTranslation` is imported at the top of `src/components/LogOverlay.tsx`, e.g.:
- `import { useTranslation } from 'react-i18next';` or whichever i18n library the project uses.
2. Initialize the translation hook in the `LogOverlay` component so that `t` is in scope for this JSX:
- e.g. inside the component: `const { t } = useTranslation();` or with the appropriate namespace: `useTranslation('logOverlay');`.
3. Add the corresponding key to your translation JSON files, for example:
- In `en/logOverlay.json` (or the relevant namespace file):
`{ "waitingLogs": "Waiting for logs..." }`
- And, if desired, in the Chinese translation file:
`{ "waitingLogs": "等待日志..." }`
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- 为 clampToScreen 添加坐标空间注释,明确物理像素一致性 - subscribeConnectionStatus 用轻量布尔比较替代 JSON.stringify - 悬浮窗空状态文案改用 i18n,入口初始化 i18n Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
太丑了,不做这玩意( |
Contributor
Author
|
我是感觉先整一个能用的也行,以后再去改美观之类的,能实时显示点信息还是有用的。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.






Summary
文件变更
新增文件
log-overlay.html- 悬浮窗 HTML 入口src/logOverlay.tsx- 悬浮窗 React 入口src/components/LogOverlay.tsx- 悬浮窗 UI 组件src/services/logOverlayService.ts- 悬浮窗服务(创建/关闭/轮询/锚点计算)src-tauri/capabilities/log-overlay.json- 悬浮窗权限配置Rust 后端
system.rs- 新增 create/close/get_rect/set_zorder/set_always_on_top 等命令types.rs- InstanceRuntime 新增 connected_window_handle 字段maa_core.rs- 连接控制器时保存窗口句柄lib.rs- 悬浮窗关闭事件处理、主窗口联动关闭前端
GeneralSection.tsx- 设置页新增悬浮窗模式/锚点/层级选项LogsPanel.tsx- 日志面板标题栏新增悬浮窗开关按钮appStore.ts/types.ts/config.ts- 状态管理和配置持久化Test plan
Made with Cursor
Summary by Sourcery
添加一个可配置的日志悬浮窗,使其可以浮动在已连接的游戏窗口附近,并将其与连接生命周期和设置持久化集成。
New Features:
Enhancements:
Build:
Original summary in English
Summary by Sourcery
Add a configurable log overlay window that can float near connected game windows and integrate it with connection lifecycle and settings persistence.
New Features:
Enhancements:
Build:
Original summary in English
Summary by Sourcery
添加一个可配置的日志悬浮窗,使其可以浮动在已连接的游戏窗口附近,并将其与连接生命周期和设置持久化集成。
New Features:
Enhancements:
Build:
Original summary in English
Summary by Sourcery
Add a configurable log overlay window that can float near connected game windows and integrate it with connection lifecycle and settings persistence.
New Features:
Enhancements:
Build: