mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-28 07:14:40 +08:00
fix(window): hover effect of the minimize and close button does not disappear
`5bb4539e3f2d04288bf52164fdbf47bcaf949aea` was accidentally reverted in `8316c75c7836af254257d6be338d99c5c4c5923c`, so we reapply it here.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
- 修复 macOS 在安装和卸载服务时提示与操作不匹配
|
||||
- 修复菜单排序模式拖拽异常
|
||||
- 修复托盘菜单代理组前的异常勾选状态
|
||||
- 修复 Windows 下自定义标题栏按钮在最小化 / 关闭后 hover 状态残留
|
||||
|
||||
<details>
|
||||
<summary><strong> ✨ 新增功能 </strong></summary>
|
||||
|
||||
@@ -6,8 +6,8 @@ export interface WindowContextType {
|
||||
maximized: boolean | null;
|
||||
toggleDecorations: () => Promise<void>;
|
||||
refreshDecorated: () => Promise<boolean>;
|
||||
minimize: () => void;
|
||||
close: () => void;
|
||||
minimize: () => Promise<void>;
|
||||
close: () => Promise<void>;
|
||||
toggleMaximize: () => Promise<void>;
|
||||
toggleFullscreen: () => Promise<void>;
|
||||
currentWindow: ReturnType<typeof getCurrentWindow>;
|
||||
|
||||
@@ -12,8 +12,16 @@ export const WindowProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
const [decorated, setDecorated] = useState<boolean | null>(null);
|
||||
const [maximized, setMaximized] = useState<boolean | null>(null);
|
||||
|
||||
const close = useCallback(() => currentWindow.close(), [currentWindow]);
|
||||
const minimize = useCallback(() => currentWindow.minimize(), [currentWindow]);
|
||||
const close = useCallback(async () => {
|
||||
// Delay one frame so the UI can clear :hover before the window hides.
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
await currentWindow.close();
|
||||
}, [currentWindow]);
|
||||
const minimize = useCallback(async () => {
|
||||
// Delay one frame so the UI can clear :hover before the window hides.
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
await currentWindow.minimize();
|
||||
}, [currentWindow]);
|
||||
|
||||
useEffect(() => {
|
||||
let isUnmounted = false;
|
||||
|
||||
Reference in New Issue
Block a user