New PositionEvent API: deliverAtPoint
does not take into account camera transformations
#2587
Labels
deliverAtPoint
does not take into account camera transformations
#2587
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: