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

[iOS] Span's TapGestureRecognizer not working if text is truncated #22213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented May 5, 2024

Issues Fixed

Windows is not working either, but I have no machine to work on it
Fixes #21837

Before After
Screen.Recording.2024-05-05.at.20.33.23.mov
Screen.Recording.2024-05-05.at.20.31.50.mov

@kubaflo kubaflo requested a review from a team as a code owner May 5, 2024 22:48
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label May 5, 2024
@jsuarezruiz
Copy link
Contributor

/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).

@@ -184,7 +184,7 @@ internal static void RecalculateSpanPositions(this UILabel control, Label elemen
var yaxis = startRect.Top;
var lineHeights = new List<double>();

while ((endRect.Bottom - yaxis) > 0.001)
while ((Math.Max(endRect.Bottom, finalSize.Bottom) - yaxis) > 0.001)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing InitialFormattedTextMatchesText test is failing on macOS. Could you try the changes on Catalyst?

System.OutOfMemoryException : Out of memory
at System.Collections.Generic.List`1[[System.Double, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_Capacity(Int32 value)
   at System.Collections.Generic.List`1[[System.Double, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Grow(Int32 capacity)
   at System.Collections.Generic.List`1[[System.Double, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].AddWithResize(Double item)
   at Microsoft.Maui.Controls.Platform.FormattedStringExtensions.RecalculateSpanPositions(UILabel control, Label element) in /Users/builder/azdo/_work/2/s/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs:line 202
   at Microsoft.Maui.Controls.Label.RecalculateSpanPositions() in /Users/builder/azdo/_work/2/s/src/Controls/src/Core/Label/Label.iOS.cs:line 61
   at Microsoft.Maui.Controls.Label.ArrangeOverride(Rect bounds) in /Users/builder/azdo/_work/2/s/src/Controls/src/Core/Label/Label.iOS.cs:line 15
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds) in /Users/builder/azdo/_work/2/s/src/Controls/src/Core/VisualElement/VisualElement.cs:line 1834
   at Microsoft.Maui.DeviceTests.HandlerTestBasement.InitializeViewHandler(IElement element, IElementHandler handler, IMauiContext mauiContext) in /Users/builder/azdo/_work/2/s/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasement.cs:line 136
   at Microsoft.Maui.DeviceTests.HandlerTestBasement.CreateHandler[LabelHandler,LabelHandler](IElement element, IMauiContext mauiContext) in /Users/builder/azdo/_work/2/s/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasement.cs:line 166
   at Microsoft.Maui.DeviceTests.HandlerTestBasement.CreateHandler[LabelHandler](IElement view, IMauiContext mauiContext) in /Users/builder/azdo/_work/2/s/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasement.cs:line 90
   at Microsoft.Maui.DeviceTests.ControlsHandlerTestBase.CreateHandler[LabelHandler](IElement view) in /Users/builder/azdo/_work/2/s/src/Controls/tests/DeviceTests/ControlsHandlerTestBase.cs:line 44
   at Microsoft.Maui.DeviceTests.LabelTests.<>c__DisplayClass17_0.<<InitialFormattedTextMatchesText>b__0>d.MoveNext() in /Users/builder/azdo/_work/2/s/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs:line 472
--- End of stack trace from previous location ---
   at Microsoft.Maui.Dispatching.DispatcherExtensions.<>c__DisplayClass3_0.<<DispatchAsync>b__0>d.MoveNext() in /Users/builder/azdo/_work/2/s/src/Core/src/Dispatching/DispatcherExtensions.cs:line 88
--- End of stack trace from previous location ---
   at Microsoft.Maui.Dispatching.DispatcherExtensions.<>c__DisplayClass2_0`1.<<DispatchAsync>b__0>d[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in /Users/builder/azdo/_work/2/s/src/Core/src/Dispatching/DispatcherExtensions.cs:line 67
--- End of stack trace from previous location ---
   at Microsoft.Maui.DeviceTests.LabelTests.InitialFormattedTextMatchesText(Double fontSize) in /Users/builder/azdo/_work/2/s/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs:line 470
--- End of stack trace from previous location ---

Copy link
Contributor Author

@kubaflo kubaflo May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuarezruiz it should work now

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-gestures Gesture types community ✨ Community Contribution platform/iOS 🍎
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Span's TapGestureRecognizer not working if text is truncated
2 participants