From 8194165a7f799f128c3a22a1a5b490289de3916f Mon Sep 17 00:00:00 2001 From: LZY <2217445143@qq.com> Date: Wed, 25 Feb 2026 20:50:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cursor_direction.py" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" "b/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" index 9311b76..07e099b 100644 --- "a/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" +++ "b/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" @@ -47,7 +47,7 @@ def calculate_cumulative_movement(sample_interval=0.01, duration=0.2): return main_direction, total_distance def wait_for_large_movement(up_th=400, down_th=400, left_th=500, right_th=550, - sample_interval=0.002, duration=0.03): + sample_interval=0.002, duration=0.02): """ 循环检测鼠标累计移动,超过阈值时返回方向 解决了"移动后回原点"导致的误判问题 -- Gitee From d37a0f0202eef167f040753e2bc6a001f93565fd Mon Sep 17 00:00:00 2001 From: LZY <2217445143@qq.com> Date: Wed, 25 Feb 2026 20:59:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=9E=83=E5=9C=BE=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cursor_direction.py" | 1 - "\351\274\240\346\240\207\346\211\213\345\212\277/main.py" | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git "a/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" "b/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" index 07e099b..fdf37f9 100644 --- "a/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" +++ "b/\351\274\240\346\240\207\346\211\213\345\212\277/cursor_direction.py" @@ -84,7 +84,6 @@ def is_mouse_pressed() -> bool: if __name__ == "__main__": print("开始检测鼠标大幅移动...") - print("提示:采样间隔0.01s,检测时长0.2s,可根据需要调整参数") while True: result = wait_for_large_movement() print("触发方向:", result) diff --git "a/\351\274\240\346\240\207\346\211\213\345\212\277/main.py" "b/\351\274\240\346\240\207\346\211\213\345\212\277/main.py" index 5037308..c89faf9 100644 --- "a/\351\274\240\346\240\207\346\211\213\345\212\277/main.py" +++ "b/\351\274\240\346\240\207\346\211\213\345\212\277/main.py" @@ -4,7 +4,8 @@ import keyboard while True: - result = cursor_direction.wait_for_large_movement() + result = cursor_direction.wait_for_large_movement(up_th=400, down_th=400, left_th=500, right_th=550, + sample_interval=0.002, duration=0.02) if cursor_direction.is_mouse_pressed(): continue # 如果鼠标按钮被按下,跳过本次检测 if result == "Right": -- Gitee