Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/events/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,15 @@ function keyboard(p5, fn){
* </div>
*/
fn._onkeyup = function(e) {

const context = this._isGlobal ? window : this;
if (typeof context.keyReleased === 'function') {
const executeDefault = context.keyReleased(e);
if (executeDefault === false) {
e.preventDefault();
}
}

delete this._downKeyCodes[e.code];
delete this._downKeys[e.key];

Expand All @@ -652,15 +661,9 @@ function keyboard(p5, fn){
this.key = lastPressedKey;
}

const context = this._isGlobal ? window : this;
if (typeof context.keyReleased === 'function') {
const executeDefault = context.keyReleased(e);
if (executeDefault === false) {
e.preventDefault();
}
}
};


/**
* A function that's called once when keys with printable characters are pressed.
*
Expand Down