Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

fix 15378 #15530

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix 15378
maonaoda committed Sep 1, 2022
commit 59350698d5e452a3c9fc0a46c7a4bb91496628d4
Original file line number Diff line number Diff line change
@@ -43,12 +43,39 @@
<Span
x:Name="Link3"
TextDecorations="Underline"
Text="Link3_1&#10;Link3_2"
Text="Link3_1&#10;Link3_2&#10;"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLink3Tapped" />
</Span.GestureRecognizers>
</Span>
<Span
x:Name="Link7"
TextDecorations="Underline"
Text="7777777777777"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLink7Tapped" />
</Span.GestureRecognizers>
</Span>
<Span
x:Name="Link8"
TextDecorations="Underline"
Text="888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888"
TextColor="Pink">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLink8Tapped" />
</Span.GestureRecognizers>
</Span>
<Span
x:Name="Link9"
TextDecorations="Underline"
Text="9999999999999999999999999999999999"
TextColor="Green">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLink9Tapped" />
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
@@ -95,11 +122,18 @@
<TapGestureRecognizer Tapped="OnLink5Tapped" />
</Span.GestureRecognizers>
</Span>
<Span Text="علي الجانب الآخر نشجب ونستنكر هؤلاء الرجال المفتونون بنشوة اللحظة الهائمون في رغباتهم فلا يدركون ما يعقبها من الألم والأسي المحتم، واللوم كذلك يشمل هؤلاء الذين أخفقوا في واجباتهم نتيجة لضعف إرادتهم فيتساوي مع هؤلاء الذين يتجنبون وينأون عن تحمل الكدح والألم ." />
</FormattedString>
<Span
x:Name="Link6"
Text="علي الجانب الآخر نشجب ونستنكر هؤلاء الرجال المفتونون بنشوة اللحظة الهائمون في رغباتهم فلا يدركون ما يعقبها من الألم والأسي المحتم، واللوم كذلك يشمل هؤلاء الذين أخفقوا في واجباتهم نتيجة لضعف إرادتهم فيتساوي مع هؤلاء الذين يتجنبون وينأون عن تحمل الكدح والألم ."
TextDecorations="Underline"
TextColor="Pink">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLink6Tapped" />
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>

</StackLayout>
</ScrollView>
</controls:TestContentPage>
Original file line number Diff line number Diff line change
@@ -44,6 +44,22 @@ void OnLink5Tapped(object sender, EventArgs e)
{
SetRandomBackgroundColor(Link5);
}
void OnLink6Tapped(object sender, EventArgs e)
{
SetRandomBackgroundColor(Link6);
}
void OnLink7Tapped(object sender, EventArgs e)
{
SetRandomBackgroundColor(Link7);
}
void OnLink8Tapped(object sender, EventArgs e)
{
SetRandomBackgroundColor(Link8);
}
void OnLink9Tapped(object sender, EventArgs e)
{
SetRandomBackgroundColor(Link9);
}
#endif

void SetRandomBackgroundColor(Span span)
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ public static void RecalculateSpanPositions(this TextView textView, Label elemen

var lineHeight = bounds.Height();
var lineStartOffset = layout.GetLineStart(curLine);
var lineVisibleEndOffset = layout.GetLineVisibleEnd(curLine);
var lineVisibleEndOffset = layout.GetLineVisibleEnd(curLine) - 1;

var startOffset = (curLine == spanStartLine) ? spanStartOffset : lineStartOffset;
var spanStartX = (int)layout.GetPrimaryHorizontal(startOffset);