mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Clear key press buffer on stop button
This commit is contained in:
parent
ebe06a97d9
commit
a785b86949
1 changed files with 10 additions and 0 deletions
|
@ -86,6 +86,9 @@ class Scratch3MakeyMakeyBlocks {
|
|||
this.keyPressed = this.keyPressed.bind(this);
|
||||
this.runtime.on('KEY_PRESSED', this.keyPressed);
|
||||
|
||||
this._clearkeyPressBuffer = this._clearkeyPressBuffer.bind(this);
|
||||
this.runtime.on('PROJECT_STOP_ALL', this._clearkeyPressBuffer);
|
||||
|
||||
/*
|
||||
* An object containing a set of sequence objects.
|
||||
* These are the key sequences currently being detected by the "when
|
||||
|
@ -337,6 +340,13 @@ class Scratch3MakeyMakeyBlocks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the key press buffer.
|
||||
*/
|
||||
_clearkeyPressBuffer () {
|
||||
this.keyPressBuffer = [];
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a key sequence to the set currently being checked on each key press.
|
||||
* @param {string} sequenceString a string of space-separated KEY_IDs.
|
||||
|
|
Loading…
Reference in a new issue