From a8f217c8c415159be1abeda3fbf17ff19038df1a Mon Sep 17 00:00:00 2001 From: yuruo Date: Mon, 10 Jun 2024 08:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20ui(autoMate):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6=E7=9A=84=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E4=BB=A5=E5=8F=8A=E5=BF=BD=E7=95=A5=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=F0=9F=93=9D=20ui(autoMate):=20=E6=9B=B4=E6=96=B0=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=A0=B7=E5=BC=8F=E4=BB=A5=E9=80=82=E9=85=8D=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E5=B9=95=20=F0=9F=93=9D=20ui(autoMate):=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4Search=E7=BB=84=E4=BB=B6=E4=B8=AD=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/autoMate/src/renderer/src/App.tsx | 15 ++++++++++++++- ui/autoMate/src/renderer/src/assets/global.scss | 2 +- .../src/renderer/src/components/Search/index.tsx | 12 +----------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ui/autoMate/src/renderer/src/App.tsx b/ui/autoMate/src/renderer/src/App.tsx index 08aa21c..7f05ebe 100644 --- a/ui/autoMate/src/renderer/src/App.tsx +++ b/ui/autoMate/src/renderer/src/App.tsx @@ -3,14 +3,27 @@ import Search from "./components/Search" import { CodeProvider } from "./context/CodeContext" import useShortCut from "./hooks/useShortCut" import Error from "./components/Error" +import { useEffect, useRef } from "react" function App(): JSX.Element { + const mainRef = useRef(null) + useEffect(()=>{ + mainRef.current?.addEventListener('mouseover', ()=>{ + window.api.setIgnoreMouseEvents(false) + }) + + document.body.addEventListener('mouseover', (e: MouseEvent)=>{ + if (e.target === document.body) { + window.api.setIgnoreMouseEvents(true, {forward: true}) + } + }) + }, []) const shortCut = useShortCut() shortCut.register("search", "CommandOrControl+n") return ( -
+
diff --git a/ui/autoMate/src/renderer/src/assets/global.scss b/ui/autoMate/src/renderer/src/assets/global.scss index 4630894..da23662 100644 --- a/ui/autoMate/src/renderer/src/assets/global.scss +++ b/ui/autoMate/src/renderer/src/assets/global.scss @@ -1,5 +1,5 @@ body{ - // @apply bg-slate-50; + @apply w-screen h-screen; } *{ diff --git a/ui/autoMate/src/renderer/src/components/Search/index.tsx b/ui/autoMate/src/renderer/src/components/Search/index.tsx index fcb03c9..a8ab24d 100644 --- a/ui/autoMate/src/renderer/src/components/Search/index.tsx +++ b/ui/autoMate/src/renderer/src/components/Search/index.tsx @@ -2,21 +2,11 @@ import { useStore } from "@renderer/store/useStore" import useSearch from "@renderer/hooks/useSearch" import { SettingOne } from "@icon-park/react" import { Input } from "antd" -import { useEffect, useRef } from "react" export default function Search(): JSX.Element { const search = useStore((state)=>state.search) const {handleSearch} = useSearch() - const mainRef = useRef(null) - useEffect(()=>{ - mainRef.current?.addEventListener('mouseover', (_e: MouseEvent)=>{ - window.api.setIgnoreMouseEvents(false) - }) - mainRef.current?.addEventListener('mouseout', (_e: MouseEvent)=>{ - window.api.setIgnoreMouseEvents(true, {forward: true}) - }) - },[]) return ( -
+