File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -441,11 +441,13 @@ p5.prototype.keyCode = 0;
441441 * </div>
442442 */
443443p5 . prototype . _onkeydown = function ( e ) {
444+ // Ignore repeated key events when holding down a key
444445 if ( e . repeat ) {
445- // Ignore repeated key events when holding down a key
446+ this . _setProperty ( 'isKeyRepeated' , true ) ;
446447 return ;
447448 }
448449
450+ this . _setProperty ( 'isKeyRepeated' , false ) ;
449451 this . _setProperty ( 'isKeyPressed' , true ) ;
450452 this . _setProperty ( 'keyIsPressed' , true ) ;
451453 this . _setProperty ( 'keyCode' , e . which ) ;
@@ -781,7 +783,7 @@ p5.prototype._onkeyup = function(e) {
781783 * </div>
782784 */
783785p5 . prototype . _onkeypress = function ( e ) {
784- if ( e . which === this . _lastKeyCodeTyped ) {
786+ if ( e . which === this . _lastKeyCodeTyped && this . isKeyRepeated ) {
785787 // prevent multiple firings
786788 return ;
787789 }
You can’t perform that action at this time.
0 commit comments