mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-16 23:40:32 +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:
parent
8316c75c78
commit
f0c7aca3ff
@ -26,6 +26,7 @@
|
|||||||
- 修复 macOS 在安装和卸载服务时提示与操作不匹配
|
- 修复 macOS 在安装和卸载服务时提示与操作不匹配
|
||||||
- 修复菜单排序模式拖拽异常
|
- 修复菜单排序模式拖拽异常
|
||||||
- 修复托盘菜单代理组前的异常勾选状态
|
- 修复托盘菜单代理组前的异常勾选状态
|
||||||
|
- 修复 Windows 下自定义标题栏按钮在最小化 / 关闭后 hover 状态残留
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><strong> ✨ 新增功能 </strong></summary>
|
<summary><strong> ✨ 新增功能 </strong></summary>
|
||||||
|
|||||||
@ -6,8 +6,8 @@ export interface WindowContextType {
|
|||||||
maximized: boolean | null;
|
maximized: boolean | null;
|
||||||
toggleDecorations: () => Promise<void>;
|
toggleDecorations: () => Promise<void>;
|
||||||
refreshDecorated: () => Promise<boolean>;
|
refreshDecorated: () => Promise<boolean>;
|
||||||
minimize: () => void;
|
minimize: () => Promise<void>;
|
||||||
close: () => void;
|
close: () => Promise<void>;
|
||||||
toggleMaximize: () => Promise<void>;
|
toggleMaximize: () => Promise<void>;
|
||||||
toggleFullscreen: () => Promise<void>;
|
toggleFullscreen: () => Promise<void>;
|
||||||
currentWindow: ReturnType<typeof getCurrentWindow>;
|
currentWindow: ReturnType<typeof getCurrentWindow>;
|
||||||
|
|||||||
@ -12,8 +12,16 @@ export const WindowProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||||||
const [decorated, setDecorated] = useState<boolean | null>(null);
|
const [decorated, setDecorated] = useState<boolean | null>(null);
|
||||||
const [maximized, setMaximized] = useState<boolean | null>(null);
|
const [maximized, setMaximized] = useState<boolean | null>(null);
|
||||||
|
|
||||||
const close = useCallback(() => currentWindow.close(), [currentWindow]);
|
const close = useCallback(async () => {
|
||||||
const minimize = useCallback(() => currentWindow.minimize(), [currentWindow]);
|
// 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(() => {
|
useEffect(() => {
|
||||||
let isUnmounted = false;
|
let isUnmounted = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user