Skip to content

Commit a899f9c

Browse files
committed
fix: fast cannot cancel when mouse wheel down roll
1 parent 22084e9 commit a899f9c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/webgal/src/hooks/useHotkey.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { setVisibility } from '@/store/GUIReducer';
1010
import { RootState } from '@/store/store';
1111
import { setOptionData } from '@/store/userDataReducer';
1212
import styles from '@/UI/Backlog/backlog.module.scss';
13+
import bottomControlPanelStyles from '@/UI/BottomControlPanel/bottomControlPanel.module.scss';
1314
import throttle from 'lodash/throttle';
1415
import { useCallback, useEffect, useRef } from 'react';
1516
import { useDispatch } from 'react-redux';
@@ -139,10 +140,18 @@ export function useMouseWheel() {
139140
// setComponentVisibility('showBacklog', false);
140141
} else if (isGameActive() && direction === 'down' && !ctrlKey) {
141142
clearTimeout(wheelTimeout);
143+
// 已开启快进模式
144+
if (WebGAL.gameplay.fastInterval !== null) {
145+
clearInterval(WebGAL.gameplay.fastInterval);
146+
WebGAL.gameplay.fastInterval = null;
147+
}
148+
const autoIcon = document.getElementById('Button_ControlPanel_fast');
142149
WebGAL.gameplay.isFast = true;
143150
// 滚轮视作快进
151+
if (autoIcon) autoIcon.className = bottomControlPanelStyles.button_on;
144152
setTimeout(() => {
145153
WebGAL.gameplay.isFast = false;
154+
if (autoIcon) autoIcon.className = bottomControlPanelStyles.singleButton;
146155
}, 150);
147156
next();
148157
}

0 commit comments

Comments
 (0)