Opt a subtree out of hitTestSelf culling
We often get questions about why hit testing "doesn't work" around transforms. The short answer is that ancestors don't ask their children to hit test if their own hitTestSelf fails (no point asking your children if they were hit if the hit wasn't inside your bounds). @csells suggested that it would be nice if a subtree could opt-in to not doing that culling. Obviously that would in general be expensive but it would be less expensive than doing a full tree walk (unless someone opted out the entire tree, obviously). I think we would still avoid doing this ever in the Flutter framework since it's better to adjust the widget hierarchy to not have ancestors of the transformed widget be smaller than that widget, but it might be useful in especially elaborate scenes where that is impractical. One way to do that would be to have HitTestResult have a flag that says whether to apply the hitTestSelf check. Having to check that flag every step of the walk would itself be not cheap, but the cost (which affects every app) might still be worth it? Another option might be to have a way for a widget to hook into the hit testing of a far ancestor (e.g. via an inherited widget). That would be better in that it would allow the whole thing to be done as a package. Maintaining paint order correctness would be distinctly non-trivial though (maybe even intractable). Any other ideas? cc @goderbauer
Posted by Hixie on Feb 10, 2021, 12:24 AM
Tags
Related issues
- In the UK Amazon have now raised the price of general shipping to be 2/3 the price of a months prime subscription.
- Credit where credit is due, critics claiming "[Apple device] is too expensive for something that just does [basic function]" have been pr...
- I like to buy music.
- Meet K-Claw.
- Fable is way too expensive for basic software stuff.
- [Meta] Abnormal Codex usage/quota depletion and usage-accounting inconsistencies — cross-report tracker
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
pricing (SaaS)
In the UK Amazon have now raised the price of general shipping to be 2/3 the price of a months prime subscription.
Credit where credit is due, critics claiming "[Apple device] is too expensive for something that just does [basic function]" have been pr...
I like to buy music.
Meet K-Claw.
Fable is way too expensive for basic software stuff.
[Meta] Abnormal Codex usage/quota depletion and usage-accounting inconsistencies — cross-report tracker
[FEATURE] Passkey (WebAuthn) sign-in for Claude accounts, across every surface
> How are Chinese companies financing their buildouts of AI infrastructure?
Opt a subtree out of hitTestSelf culling
We often get questions about why hit testing "doesn't work" around transforms. The short answer is that ancestors don't ask their children to hit test if their own hitTestSelf fails (no point asking your children if they were hit if the hit wasn't inside your bounds). @csells suggested that it would be nice if a subtree could opt-in to not doing that culling. Obviously that would in general be expensive but it would be less expensive than doing a full tree walk (unless someone opted out the entire tree, obviously). I think we would still avoid doing this ever in the Flutter framework since it's better to adjust the widget hierarchy to not have ancestors of the transformed widget be smaller than that widget, but it might be useful in especially elaborate scenes where that is impractical. One way to do that would be to have HitTestResult have a flag that says whether to apply the hitTestSelf check. Having to check that flag every step of the walk would itself be not cheap, but the cost (which affects every app) might still be worth it? Another option might be to have a way for a widget to hook into the hit testing of a far ancestor (e.g. via an inherited widget). That would be better in that it would allow the whole thing to be done as a package. Maintaining paint order correctness would be distinctly non-trivial though (maybe even intractable). Any other ideas? cc @goderbauer
Comments (0)
No comments yet. Start the discussion.