Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix for span GestureRecognizers don't work when the span is wrapped over two lines. #25180

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Tamilarasan-Paranthaman
Copy link
Contributor

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman commented Oct 10, 2024

Root Cause of the issue

If the span is wrapped across two lines, the Android Text layout method GetLineVisibleEnd returns the position right after the last visible character on the line. Therefore, the Text layout GetSecondaryHorizontal method returned the value 0 when finding the spanEndX value. Here, the value of spanEndX is less than that of spanStartX. As a result, spanEndX was defaulted to 0, which caused the issue.

Description of Change

We can get the exact offset of the last visible character, by subtracting 1 from this position of the endOffset when finding spanEndX.

Issues Fixed

Fixes #23801

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix
Text-Span_GestureRecognizer-Issue.mp4
Text-Span-GestureRecognizer-fix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 10, 2024
Copy link
Contributor

Hey there @Tamilarasan-Paranthaman! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Oct 11, 2024

/azp run

@jsuarezruiz jsuarezruiz added the area-gestures Gesture types label Oct 11, 2024
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Tamilarasan-Paranthaman
Copy link
Contributor Author

/rebase

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR2 milestone Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Approved
Development

Successfully merging this pull request may close these issues.

[Android] Span GestureRecognizers don't work when the span is wrapped over two lines.
4 participants