From 9fd70789685fe9015ffa15b4c29adb3df20e794f Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Thu, 17 Mar 2022 07:59:49 +0000 Subject: [PATCH] fix: correctly handled key propagation (#53) --- lib/game/components/flipper.dart | 5 +---- lib/game/components/plunger.dart | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/game/components/flipper.dart b/lib/game/components/flipper.dart index 8b029b1e..3d77a57b 100644 --- a/lib/game/components/flipper.dart +++ b/lib/game/components/flipper.dart @@ -203,9 +203,6 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition { RawKeyEvent event, Set 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 (event is RawKeyDownEvent) { @@ -214,7 +211,7 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition { _moveDown(); } - return true; + return false; } } diff --git a/lib/game/components/plunger.dart b/lib/game/components/plunger.dart index 6f319bd3..61abaf1d 100644 --- a/lib/game/components/plunger.dart +++ b/lib/game/components/plunger.dart @@ -57,9 +57,6 @@ class Plunger extends BodyComponent with KeyboardHandler, InitialPosition { LogicalKeyboardKey.arrowDown, 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 (event is RawKeyDownEvent) { @@ -68,7 +65,7 @@ class Plunger extends BodyComponent with KeyboardHandler, InitialPosition { _release(); } - return true; + return false; } /// Anchors the [Plunger] to the [PrismaticJoint] that controls its vertical