flutter/packages
LongCatIsLooong 5883a6ca10
Reland "Make TextSpan hit testing precise." (#140468) (#140621)
Fixes https://github.com/flutter/flutter/issues/131435, https://github.com/flutter/flutter/issues/104594, https://github.com/flutter/flutter/issues/43400

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text.

The new TextPaintes method tells you the layout bounds `(width =  letterspacing / 2 + x_advance + letterspacing / 2, height = font ascent + font descent)` of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of its character's layout bounds.

Potential issues:

In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference.
This is a breaking change.
2024-01-02 20:26:12 +00:00
..
flutter Reland "Make TextSpan hit testing precise." (#140468) (#140621) 2024-01-02 20:26:12 +00:00
flutter_driver Add send_text_input_action case to deserialization_factory to allow sendTextInputAction usages through flutter_driver. (#139197) 2023-12-21 17:48:16 +00:00
flutter_goldens Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101) 2023-12-21 21:35:07 +00:00
flutter_localizations Roll pub packages (#140472) 2023-12-20 22:57:21 +00:00
flutter_test Revert "Integrate testWidgets with leak tracking. (#138057)" (#140502) 2023-12-21 12:44:58 +01:00
flutter_tools Update dependencies with flutter update-packages --force-upgrade (#140810) 2024-01-02 12:10:10 -08:00
flutter_web_plugins Roll pub packages (#140472) 2023-12-20 22:57:21 +00:00
fuchsia_remote_debug_protocol Upgrade to version of leak tracker that does not depend on test_widgets. (#140247) 2023-12-19 04:28:09 +00:00
integration_test Set template and migrate apps to iOS 12 minimum (#140478) 2024-01-02 19:42:13 +00:00
analysis_options.yaml Unify analysis options (#108462) 2022-07-28 09:07:49 -07:00