From 789cd5b99156a05f3c515cbccfbb7253b4bffd2f Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 21 Jan 2025 10:31:26 +0000 Subject: [PATCH] Remove deprecated isKeyPressed property --- src/events/keyboard.js | 5 +---- test/unit/events/keyboard.js | 16 ---------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/events/keyboard.js b/src/events/keyboard.js index 5b0de949ed..a2554947ce 100644 --- a/src/events/keyboard.js +++ b/src/events/keyboard.js @@ -95,8 +95,7 @@ function keyboard(p5, fn){ * * */ - fn.isKeyPressed = false; - fn.keyIsPressed = false; // khan + fn.keyIsPressed = false; /** * A `String` system variable that contains the value of the last key typed. @@ -444,7 +443,6 @@ function keyboard(p5, fn){ // prevent multiple firings return; } - this.isKeyPressed = true; this.keyIsPressed = true; this.keyCode = e.which; this._downKeys[e.which] = true; @@ -617,7 +615,6 @@ function keyboard(p5, fn){ this._downKeys[e.which] = false; if (!this._areDownKeys()) { - this.isKeyPressed = false; this.keyIsPressed = false; } diff --git a/test/unit/events/keyboard.js b/test/unit/events/keyboard.js index 1ce199c66a..0e55657e88 100644 --- a/test/unit/events/keyboard.js +++ b/test/unit/events/keyboard.js @@ -38,22 +38,6 @@ suite('Keyboard Events', function() { }); }); - suite('p5.prototype.isKeyPressed', function() { - test('isKeyPressed should be a boolean', function() { - assert.isBoolean(myp5.isKeyPressed); - }); - - test('isKeyPressed should be true on key press', function() { - window.dispatchEvent(new KeyboardEvent('keydown')); - assert.strictEqual(myp5.isKeyPressed, true); - }); - - test('isKeyPressed should be false on key up', function() { - window.dispatchEvent(new KeyboardEvent('keyup')); - assert.strictEqual(myp5.isKeyPressed, false); - }); - }); - suite('p5.prototype.key', function() { test('key should be a string', async function() { window.dispatchEvent(new KeyboardEvent('keydown', { key: 's' }));