-
-
Notifications
You must be signed in to change notification settings - Fork 899
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
New PositionEvent API: deliverAtPoint
does not take into account camera transformations
#2587
Labels
Comments
Unfortunately flame_forge2d is in a bit of a bad state now since it hasn't fully been converted to use the |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current bug behavior
The
PositionEvent.deliverAtPoint
function usesComponent.componentsAtPoint(canvasPosition, renderingTrace)
to find all affected components. AscanvasPosition
does not apply any camera transformation, it is actually not "local" to the rootComponent, as expected bycomponentsAtPoint
(from here:
/// An iterable of descendant components intersecting the given point. The
/// [point] is in the local coordinate space.
[...]
). This leads to some components not receiving tap/drag events while they definitely should.
A workaround is to transform the point in
containsLocalPoint
manually, but that shouldn't be the final solution.Expected behavior
Components in a FlameGame with camera zoom receive tap/drag events while not having to override
containsLocalPoint
.Steps to reproduce
The rectangle changes its color if tapped. With
zoom: 10
only a tiny portion on the top left corner is sensitive to tap events. When clicking at the middle of the rectangle, nothing happens. Withzoom: 1
everything is fine.Example: https://zfy062sfz06.zapp.page/
Code:
Flutter doctor output
More environment information
More information
The old legacy Tap/Drag APIs do not have this problem, as the parameter to
containsPoint
is first transformed througheventPosition(info)
(here).The text was updated successfully, but these errors were encountered: