Skip to content

Commit 789cd5b

Browse files
committed
Remove deprecated isKeyPressed property
1 parent f6c8fcf commit 789cd5b

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

src/events/keyboard.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ function keyboard(p5, fn){
9595
* </code>
9696
* </div>
9797
*/
98-
fn.isKeyPressed = false;
99-
fn.keyIsPressed = false; // khan
98+
fn.keyIsPressed = false;
10099

101100
/**
102101
* A `String` system variable that contains the value of the last key typed.
@@ -444,7 +443,6 @@ function keyboard(p5, fn){
444443
// prevent multiple firings
445444
return;
446445
}
447-
this.isKeyPressed = true;
448446
this.keyIsPressed = true;
449447
this.keyCode = e.which;
450448
this._downKeys[e.which] = true;
@@ -617,7 +615,6 @@ function keyboard(p5, fn){
617615
this._downKeys[e.which] = false;
618616

619617
if (!this._areDownKeys()) {
620-
this.isKeyPressed = false;
621618
this.keyIsPressed = false;
622619
}
623620

test/unit/events/keyboard.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,6 @@ suite('Keyboard Events', function() {
3838
});
3939
});
4040

41-
suite('p5.prototype.isKeyPressed', function() {
42-
test('isKeyPressed should be a boolean', function() {
43-
assert.isBoolean(myp5.isKeyPressed);
44-
});
45-
46-
test('isKeyPressed should be true on key press', function() {
47-
window.dispatchEvent(new KeyboardEvent('keydown'));
48-
assert.strictEqual(myp5.isKeyPressed, true);
49-
});
50-
51-
test('isKeyPressed should be false on key up', function() {
52-
window.dispatchEvent(new KeyboardEvent('keyup'));
53-
assert.strictEqual(myp5.isKeyPressed, false);
54-
});
55-
});
56-
5741
suite('p5.prototype.key', function() {
5842
test('key should be a string', async function() {
5943
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's' }));

0 commit comments

Comments
 (0)