From c429632d80c328dab3868335a63d0affe95dd327 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Sat, 7 Mar 2026 13:58:50 +0800 Subject: [PATCH] refactor: update PointerSensor activation constraint to improve responsiveness --- src/components/home/test-card.tsx | 6 +++++- src/components/profile/groups-editor-viewer.tsx | 4 +++- src/components/profile/proxies-editor-viewer.tsx | 4 +++- src/components/profile/rules-editor-viewer.tsx | 4 +++- src/components/proxy/proxy-chain.tsx | 4 +++- src/pages/profiles.tsx | 4 +++- src/pages/test.tsx | 4 +++- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/components/home/test-card.tsx b/src/components/home/test-card.tsx index ffaa69c91..8eddc2863 100644 --- a/src/components/home/test-card.tsx +++ b/src/components/home/test-card.tsx @@ -70,7 +70,11 @@ const DEFAULT_TEST_LIST = [ export const TestCard = () => { const { t } = useTranslation(); - const sensors = useSensors(useSensor(PointerSensor)); + const sensors = useSensors( + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), + ); const { verge, mutateVerge, patchVerge } = useVerge(); const viewerRef = useRef(null); diff --git a/src/components/profile/groups-editor-viewer.tsx b/src/components/profile/groups-editor-viewer.tsx index 8dd8be433..5553117f4 100644 --- a/src/components/profile/groups-editor-viewer.tsx +++ b/src/components/profile/groups-editor-viewer.tsx @@ -189,7 +189,9 @@ export const GroupsEditorViewer = (props: Props) => { ); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }), diff --git a/src/components/profile/proxies-editor-viewer.tsx b/src/components/profile/proxies-editor-viewer.tsx index 0dd673022..1379494ec 100644 --- a/src/components/profile/proxies-editor-viewer.tsx +++ b/src/components/profile/proxies-editor-viewer.tsx @@ -85,7 +85,9 @@ export const ProxiesEditorViewer = (props: Props) => { ); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }), diff --git a/src/components/profile/rules-editor-viewer.tsx b/src/components/profile/rules-editor-viewer.tsx index ea04b141f..9c96e8028 100644 --- a/src/components/profile/rules-editor-viewer.tsx +++ b/src/components/profile/rules-editor-viewer.tsx @@ -296,7 +296,9 @@ export const RulesEditorViewer = (props: Props) => { ); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }), diff --git a/src/components/proxy/proxy-chain.tsx b/src/components/proxy/proxy-chain.tsx index b668b84ac..8b1c5ade4 100644 --- a/src/components/proxy/proxy-chain.tsx +++ b/src/components/proxy/proxy-chain.tsx @@ -277,7 +277,9 @@ export const ProxyChain = ({ }, [proxyChain.length, markUnsavedChanges]); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }), diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index 2162b60b8..737c866bc 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -163,7 +163,9 @@ const ProfilePage = () => { [], ); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }), diff --git a/src/pages/test.tsx b/src/pages/test.tsx index 5b85dae3b..af9bc2e42 100644 --- a/src/pages/test.tsx +++ b/src/pages/test.tsx @@ -31,7 +31,9 @@ import { useVerge } from "@/hooks/use-verge"; const TestPage = () => { const { t } = useTranslation(); const sensors = useSensors( - useSensor(PointerSensor), + useSensor(PointerSensor, { + activationConstraint: { distance: 8 }, + }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, }),