File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,8 @@ define(function (require) {
166166 'touchstart' : null ,
167167 'touchmove' : null ,
168168 'touchend' : null ,
169- 'resize' : null
169+ 'resize' : null ,
170+ 'blur' : null
170171 } ;
171172 this . _loadingScreenId = 'p5_loading' ;
172173
Original file line number Diff line number Diff line change @@ -223,6 +223,15 @@ define(function (require) {
223223 }
224224 }
225225 } ;
226+ /**
227+ * The onblur function is called when the user is no longer focused
228+ * on the p5 element. Because the keyup events will no fire if the user is
229+ * not focused on the element we must assume all keys currently down have
230+ * been released.
231+ */
232+ p5 . prototype . onblur = function ( e ) {
233+ downKeys = { } ;
234+ } ;
226235
227236 /**
228237 * The keyIsDown function checks if the key is currently down, i.e. pressed.
You can’t perform that action at this time.
0 commit comments