|
@ -500,6 +500,8 @@ export class GestureHandler { |
|
|
* 获取指定手指的指尖 landmark |
|
|
* 获取指定手指的指尖 landmark |
|
|
* fingerIndex: 0=拇指, 1=食指, 2=中指, ... |
|
|
* fingerIndex: 0=拇指, 1=食指, 2=中指, ... |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
private lastModeSwitchTime: number = 0; |
|
|
|
|
|
private readonly MODE_SWITCH_INTERVAL = 3000; // 3秒
|
|
|
private getFingerTip(hand: HandInfo, fingerIndex: number) { |
|
|
private getFingerTip(hand: HandInfo, fingerIndex: number) { |
|
|
if (!hand) return null; |
|
|
if (!hand) return null; |
|
|
|
|
|
|
|
@ -519,9 +521,14 @@ export class GestureHandler { |
|
|
this.previousGestureCount = 1; |
|
|
this.previousGestureCount = 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const app_store = use_app_store(); |
|
|
|
|
|
|
|
|
|
|
|
if (gesture === HandGesture.ROCK_SWITCH_MODE) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const app_store = use_app_store(); |
|
|
|
|
|
if (gesture === HandGesture.ROCK_SWITCH_MODE) { |
|
|
|
|
|
const now = Date.now(); |
|
|
|
|
|
if (now - this.lastModeSwitchTime >= this.MODE_SWITCH_INTERVAL) { |
|
|
|
|
|
this.lastModeSwitchTime = now; |
|
|
|
|
|
|
|
|
if (app_store.mode === 'normal') { |
|
|
if (app_store.mode === 'normal') { |
|
|
app_store.mode = 'music'; |
|
|
app_store.mode = 'music'; |
|
|
app_store.sub_window_info("🎵 切换到音乐模式"); |
|
|
app_store.sub_window_info("🎵 切换到音乐模式"); |
|
@ -529,9 +536,9 @@ export class GestureHandler { |
|
|
app_store.mode = 'normal'; |
|
|
app_store.mode = 'normal'; |
|
|
app_store.sub_window_info("💼 切换到普通模式"); |
|
|
app_store.sub_window_info("💼 切换到普通模式"); |
|
|
} |
|
|
} |
|
|
return; // 切换后不继续处理其他手势
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return; // 不管有没有切换,都返回,不再处理其他手势
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|