backbone icon indicating copy to clipboard operation
backbone copied to clipboard

Exception on input handling

Open Dan-Crane opened this issue 2 years ago β€’ 5 comments

Holla :)

I get an exception when I release the mouse button outside the screen area.

Video

https://user-images.githubusercontent.com/56475207/218053265-893c0b2a-766c-4907-8911-a90b7519b8ba.mov

Logs:
Restarted application in 208ms.

════════ Exception caught by gesture library ═══════════════════════════════════
The following StateError was thrown while routing a pointer event:
Bad state: No element

When the exception was thrown, this was the stack
#0      ListMixin.firstWhere (dart:collection/list.dart:167:5)
#1      Input.onPointerRemoved
#2      _BackboneGameWidgetState._handleEvent
#3      PointerRouter._dispatch
#4      PointerRouter._dispatchEventToRoutes.<anonymous closure>
#5      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#6      PointerRouter._dispatchEventToRoutes
#7      PointerRouter.route
#8      GestureBinding.dispatchEvent
#9      RendererBinding.dispatchEvent
#10     GestureBinding._handlePointerEventImmediately
#11     GestureBinding.handlePointerEvent
#12     GestureBinding._flushPointerEventQueue
#13     GestureBinding._handlePointerDataPacket
#14     _invoke1 (dart:ui/hooks.dart:164:13)
#15     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
#16     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)
════════════════════════════════════════════════════════════════════════════════

Stacktrace leads to this place: https://github.com/sturdykeep/backbone/blob/c3ecf08c43dc03f4c0518e61a5ccb2eefc9825fa/lib/prelude/input/mod.dart#L117

Dan-Crane avatar Feb 10 '23 09:02 Dan-Crane

Hi @Dan-Crane thanks for reporting I guess you run into #35 , there are some special cases for input handling on different platforms. We will handle this more gracefully, there is also an issue in Flutter that some platforms don't send in events to cancel some states like hover.

If you have a suggestion on how to improve don't hesitate to get in touch :)

Dev-Owl avatar Feb 10 '23 09:02 Dev-Owl

Oops, didn't noticeπŸ™ˆ

Dan-Crane avatar Feb 10 '23 09:02 Dan-Crane

No worries, we are currently working on adding further default traits/system to backbone, if you checkout the "Dash Tennis" project you can see that it has traits & systems for sprite and text handling.

The plan is to introduce systems that can also directly render, so people can but don't have to use a sprite component just for drawing.

Dev-Owl avatar Feb 10 '23 10:02 Dev-Owl

@Dan-Crane, can you check if the latest merges into main fixed your issue?

skyne98 avatar Feb 16 '23 16:02 skyne98

@skyne98, no, the problem is still there.

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale en-RU)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2021.3)
[βœ“] VS Code (version 1.75.1)
[βœ“] Connected device (2 available)
[βœ“] HTTP Host Availability
β€’ No issues found!

Dan-Crane avatar Feb 21 '23 07:02 Dan-Crane