scrollAnchorAt method
The anchor of the innermost scrollable whose viewport contains logical point x, y; null when the point is over no scrollable.
Implementation
Future<ScrollAnchor?> scrollAnchorAt(Scene scene, SemanticScene semantic, double x, double y) async {
ScrollAnchor? best;
var bestArea = double.infinity;
for (final list in semantic.root.walk().whereType<SemanticList>()) {
final anchor = await _anchorWithin(scene, list);
final clip = anchor?.clip;
if (anchor == null || clip == null) continue;
final contains = x >= clip.x && x <= clip.x + clip.w && y >= clip.y && y <= clip.y + clip.h;
if (contains && clip.w * clip.h < bestArea) {
best = anchor;
bestArea = clip.w * clip.h;
}
}
return best;
}