New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add HoverCallbacks #2706
feat: Add HoverCallbacks #2706
Conversation
} | ||
|
||
@override | ||
String toString() => 'PointerMoveEvent(devicePosition: $devicePosition, ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to followup with some simplifications around duplicated code between "events"
|
||
/// Set by the PointerMoveDispatcher to receive mouse events from the | ||
/// game widget. | ||
void Function(PointerHoverEvent event)? mouseDetector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly this does not seem to be possible to be included under the gestureDetectors - events don't fire as intended.
There are two other people that have worked on the Hover callbacks so far, one in #1834 and the other is a thread on Discord, would be good if you could check with them what they have done so far. |
@spydon this idea is interesting: even though it is my understanding that we are removing tapables, etc. but the way to handle the wiring of the events between game widget and game could be through a that would serve a similar purpose to our does this make sense? if so I can try to put a draft together to see what it would look like I wonder if that should be a followup though - I think we are sorely lacking a replacement for HasHoverables within the new system so wanted to find the quickest way to provide that on the current structure |
Up to you, I don't have time to properly review anything until Wednesday anyways. The hoverables are the least used detector, so I don't think it is that much of a rush. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good! I would have expected it to be more messy.
Anything more than docs missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Just docs missing
packages/flame/lib/src/events/component_mixins/hover_callbacks.dart
Outdated
Show resolved
Hide resolved
….dart Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
@spydon added docs, please take a look! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!!
Description
Currently Flame is in a state of disarray.
Hoverables
(andHasHoverables
) are deprecated, claiming that they should be replaced with "HoverCallbacks". However, try as you might, "HoverCallbacks" does not seem to exist.In fact, upon further analysis, there does not seem to be any way whatsoever to replace the currently deprecated classes. I do not think it is acceptable to have a deprecated method without a replacement, so this provides one.
This creates HoverCallbacks (and PointerMoveCallbacks) to replicate the Hoverables behaviour in the new camera and event system.
The internal wiring becomes a bit messy because wiring it via a GestureRecognizer does not seem to work. The gesture recognizer seems to only receive pointer events when dragging the mouse.
That can potentially be improved on followups, as long as the functionality is maintained.
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?