This commit is contained in:
2024-10-01 19:34:02 +02:00
parent efb6482238
commit 375d47397e
3 changed files with 11 additions and 6 deletions

View File

@ -306,7 +306,7 @@ class Tetromino extends THREE.Group {
} else if (translation == TRANSLATION.DOWN) {
this.locked = true
if (!scheduler.timeoutTasks.has(this.onLockDown))
scheduler.setTimeout(this.onLockDown, this.lockDelay)
scheduler.resetTimeout(this.onLockDown, this.lockDelay)
}
}

View File

@ -15,6 +15,11 @@ class Scheduler {
}
}
resetInterval(func, delay, ...args) {
this.clearInterval(func)
this.setInterval(func, delay, ...args)
}
setTimeout(func, delay, ...args) {
this.timeoutTasks.set(func, window.setTimeout(func, delay, ...args))
}