Open
Conversation
added 19 commits
March 20, 2026 22:02
Made-with: Cursor
…exToRgba safety - Integrate objc2 crate to properly set NSWindow transparent background - Fix hexToRgba to handle undefined color values - Enhance overlay.html CSS for better transparency support Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
- Remove fullscreen(true) which causes black screen on Windows - Use set_position/set_size to cover primary monitor instead - macOS keeps fullscreen for best transparency support Made-with: Cursor
- Change main window default size from 400x600 to 960x640 - Expand BUILTIN_PRESETS from 16 to 122 crosshair styles - Add helper function for cleaner preset definition - Add tournament presets for popular esports titles Made-with: Cursor
- 添加 exit_app 命令,使用 Tauri API 正确退出应用
- 修复 Quit 菜单:使用 invoke('exit_app') 替代 window.close()
- 修复窗口关闭按钮:添加 CloseRequested 事件监听,关闭窗口时退出整个应用
- 移除 iconAsTemplate 配置(Windows 不兼容)
Made-with: Cursor
Made-with: Cursor
托盘修复: - 移除 tauri.conf.json 中的 trayIcon 配置,避免与前端创建的托盘冲突 - 在 useTray.ts 中添加 defaultWindowIcon() 作为托盘图标 - 增强 show_settings 命令,添加 request_user_attention 使窗口更容易唤醒 - 添加 core:app:default 和 request-user-attention 权限 UI 美化: - 将固定宽度布局改为响应式 grid 布局,适配窗口大小变化 - 优化 Preview 预览区域,使用渐变背景和阴影效果 - 美化滑块样式,添加渐变进度条 - 改进颜色选择器按钮的阴影和缩放动画 - 将复选框改为更现代的 Switch 滑动开关样式 - 优化保存按钮,添加渐变背景和悬停动效 - 统一圆角、间距和字体大小等设计细节 Made-with: Cursor
准星透明背景修复: - 优化 overlay.html 的 CSS,彻底移除所有背景色 - 简化 CrosshairOverlayApp.tsx 的透明设置逻辑 - 添加 Windows WebView 兼容的 CSS 样式 响应式布局优化: - SettingsPanel 改为 minmax(260px, 1fr) 更好地适配小窗口 - 预览区域 maxWidth 从 240px 调整为 200px 适应小窗口 - 样式按钮网格改为 minmax(64px, 1fr) 更紧凑 - 添加 flexWrap 使标题在小窗口换行显示 Made-with: Cursor
Made-with: Cursor
Windows 准星透明背景: - 添加 webview2-com 依赖,用于设置 WebView2 背景色为透明 单实例检测: - 添加 tauri-plugin-single-instance 插件 - 防止用户重复启动多个应用 - 第二个实例会自动聚焦到主窗口 交互体验优化: - 滑块组件添加 +/- 按钮,可直接点击调整数值 - 滑块添加直接输入框,可输入精确数值 - 支持键盘上下箭头调整(焦点在输入框时) - 支持鼠标滚轮滚动调整数值 Made-with: Cursor
- Remove webview2-com from Windows dependencies - Simplify lib.rs by removing manual WebView2 transparency code - Transparency now handled by Tauri via .transparent(true)
- Add overlay.set_background_color(Color { r: 0, g: 0, b: 0, a: 0 })
for Windows so WebView2 renders with a fully transparent background.
On Windows 8+ the alpha=0 channel is required for transparency.
- Change minimize_to_tray to use minimize() instead of hide():
hide() removes the window and its taskbar icon entirely on Windows,
while minimize() keeps the taskbar icon visible and clickable.
- Remove windows crate dependency (no longer needed after switching
to Tauri's native set_background_color API).
Made-with: Cursor
…_color Color is a tuple struct (not named fields), and set_background_color expects Option<Color>. Fix: Color(0, 0, 0, 0) wrapped in Some(). Made-with: Cursor
…ttributes The WebView2 window chrome/border shows through as a black frame. Fix it by calling SetLayeredWindowAttributes with LWA_COLORKEY on the raw HWND — this makes all black pixels fully transparent while the crosshair (drawn in a non-black color) remains visible. Made-with: Cursor
Root cause: the WebView2 layer background was never being set to transparent because: 1. set_background_color was called but the Color tuple struct syntax was wrong (named fields instead of positional). 2. The capabilities/default.json was missing core:webview:default and core:window:allow-set-background-color permissions, so the plugin commands were silently denied. 3. The background color needed to be set from INSIDE the webview (overlay.html) for WebView2 to pick it up reliably. Fix: - Fix Color tuple syntax: Color(0, 0, 0, 0) with Some() wrapper. - Add core:webview:default and core:window:allow-set-background-color to capabilities. - Call setBackgroundColor([0,0,0,0]) from overlay.html JS on init — this runs inside WebView2 and is the most reliable place. - Reinforce set_background_color in set_crosshair_visible when the window is shown, guarding against WebView2 reset-on-show. - Remove the windows crate SetLayeredWindowAttributes workaround. Made-with: Cursor
…liably The ES module script in overlay.html might execute before WebView2 is fully ready, causing setBackgroundColor to be ignored. Fix by: - Listen to the 'initialized' event and call setBackgroundColor when the webview is guaranteed to be ready. - Also call immediately as a fallback (in case it fires before listener setup) with a 200ms retry for safety. - Keep reinforcing from Rust side on every show() as defense-in-depth. Made-with: Cursor
…ming Root causes found after thorough analysis: 1. CROSSHAIR_WINDOW_CREATED had an 800ms delay in setup(), so the overlay wasn't created when the user first clicked "show". Fixed by calling create_and_show_overlay immediately (no delay) so the window exists before any user interaction. 2. CrosshairOverlayApp.tsx called win.show() AGAIN with a 150ms delay AFTER the Rust side already showed the window. This double-show caused WebView2 to re-render its black background before CSS was applied. Removed — Rust side handles showing correctly. 3. SetLayeredWindowAttributes was called AFTER overlay.show() in the Rust create_and_show_overlay function, but there was also an EARLIER duplicate Windows block that called it before positioning the window. Cleaned up to one clean block that: a) Positions the overlay over the primary monitor (同步) b) Spawns a thread: waits 600ms for WebView2 init c) Sets WS_EX_LAYERED on the HWND d) Calls overlay.show() — WebView2 renders into the layered surface e) Calls SetLayeredWindowAttributes(hwnd, NULL, 0, LWA_ALPHA) LWA_ALPHA makes every pixel fully transparent. The canvas body is transparent so the crosshair is the only visible thing. No black border. 4. overlay.html had redundant JS setBackgroundColor calls that were unnecessary since Rust now handles it correctly via Win32 API. Made-with: Cursor
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.
No description provided.