fix: correctly handled key propagation (#53)

pull/59/head
Alejandro Santiago 2 years ago committed by GitHub
parent dc3de740d3
commit 9fd7078968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -203,9 +203,6 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition {
RawKeyEvent event, RawKeyEvent event,
Set<LogicalKeyboardKey> keysPressed, Set<LogicalKeyboardKey> keysPressed,
) { ) {
// TODO(alestiago): Check why false cancels the event for other components.
// Investigate why return is of type [bool] expected instead of a type
// [KeyEventResult].
if (!_keys.contains(event.logicalKey)) return true; if (!_keys.contains(event.logicalKey)) return true;
if (event is RawKeyDownEvent) { if (event is RawKeyDownEvent) {
@ -214,7 +211,7 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition {
_moveDown(); _moveDown();
} }
return true; return false;
} }
} }

@ -57,9 +57,6 @@ class Plunger extends BodyComponent with KeyboardHandler, InitialPosition {
LogicalKeyboardKey.arrowDown, LogicalKeyboardKey.arrowDown,
LogicalKeyboardKey.keyS, LogicalKeyboardKey.keyS,
]; ];
// TODO(alestiago): Check why false cancels the event for other components.
// Investigate why return is of type [bool] expected instead of a type
// [KeyEventResult].
if (!keys.contains(event.logicalKey)) return true; if (!keys.contains(event.logicalKey)) return true;
if (event is RawKeyDownEvent) { if (event is RawKeyDownEvent) {
@ -68,7 +65,7 @@ class Plunger extends BodyComponent with KeyboardHandler, InitialPosition {
_release(); _release();
} }
return true; return false;
} }
/// Anchors the [Plunger] to the [PrismaticJoint] that controls its vertical /// Anchors the [Plunger] to the [PrismaticJoint] that controls its vertical

Loading…
Cancel
Save