refactor(customCursor.ts): rename addActiveCallback to active.addWatcher for better readability and consistency

refactor(stageNav.ts): rename getIsAnimating to isAnimating.get for better readability and consistency
refactor(stageNav.ts): rename addActiveCallback to active.addWatcher for better readability and consistency
feat(stageNav.ts): add check for isOpen.get() and isAnimating.get() before handling key events to prevent unwanted actions
This commit is contained in:
Sped0n
2023-10-29 02:42:04 +08:00
parent 817b543ee0
commit e93bca55d5
2 changed files with 9 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
import { addActiveCallback } from './stage'
import { active } from './stage'
let cursor: HTMLDivElement
@@ -24,8 +24,8 @@ export function initCustomCursor(): void {
// bind mousemove event to window
window.addEventListener('mousemove', onMouse)
// add active callback
addActiveCallback((active) => {
if (active) {
active.addWatcher(() => {
if (active.get()) {
cursor.classList.add('active')
} else {
cursor.classList.remove('active')