mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-05-21 15:26:31 +08:00

This PR adds hit testing to Flutter by overriding `hitTestSelf` on the Rive RenderObject. Currently, the hit area is the entire bounding box of the canvas. This means that when a Rive animation is rendered above any other Flutter content (for example, a Stack) all hits are absorbed by Rive and do not pass through. With this change, Rive will only absorb hits if the pointer comes in contact with a hittable Rive element. With this change, `handleEvent` will only be called if `hitTestSelf` returns true. There is some duplicate work here as `_processEvent` already performs similar hit test logic, which we can look at optimizing. But `hitTest` needed to be separate method call, as `hitTestSelf` is called before `handleEvent` and `handleEvent` sends additional information (whether it's a pointer down/up etc.). Diffs= 95beaa4f5 feat: add flutter hit test self on rive render object (#6341) bd71143bc chore: fix broken docs link (#6360) Co-authored-by: Gordon <pggordonhayes@gmail.com>