mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #966 from Rishab87/unit-tests-key-event
Added unit tests for handling key events in ```processing:core```
This commit is contained in:
@@ -2635,8 +2635,11 @@ public class PApplet implements PConstants {
|
||||
keyPressed = true;
|
||||
keyPressed(keyEvent);
|
||||
}
|
||||
case KeyEvent.RELEASE -> {
|
||||
pressedKeys.remove(((long) keyCode << Character.SIZE) | key);
|
||||
case KeyEvent.RELEASE -> {
|
||||
pressedKeys.removeIf(hash -> {
|
||||
int pressedKeyCode = (int)(hash >> Character.SIZE);
|
||||
return pressedKeyCode == keyCode;
|
||||
});
|
||||
keyPressed = !pressedKeys.isEmpty();
|
||||
keyReleased(keyEvent);
|
||||
}
|
||||
@@ -2842,6 +2845,7 @@ public class PApplet implements PConstants {
|
||||
public void focusLost() {
|
||||
// TODO: if user overrides this without calling super it's not gonna work
|
||||
pressedKeys.clear();
|
||||
keyPressed = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user