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
6 changes: 4 additions & 2 deletions src/events/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,13 @@ p5.prototype.keyCode = 0;
* </div>
*/
p5.prototype._onkeydown = function(e) {
// Ignore repeated key events when holding down a key
if (e.repeat) {
// Ignore repeated key events when holding down a key
this._setProperty('isKeyRepeated', true);
return;
}

this._setProperty('isKeyRepeated', false);
this._setProperty('isKeyPressed', true);
this._setProperty('keyIsPressed', true);
this._setProperty('keyCode', e.which);
Expand Down Expand Up @@ -781,7 +783,7 @@ p5.prototype._onkeyup = function(e) {
* </div>
*/
p5.prototype._onkeypress = function(e) {
if (e.which === this._lastKeyCodeTyped) {
if (e.which === this._lastKeyCodeTyped && this.isKeyRepeated) {
// prevent multiple firings
return;
}
Expand Down