Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 60620a2

Browse files
committed
bug fix on comparing textSpan
1 parent a6ad616 commit 60620a2

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Runtime/painting/basic_types.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Unity.UIWidgets.painting {
55
public enum RenderComparison {
66
identical,
77
metadata,
8+
hoverCallback,
89
paint,
910
layout,
1011
}

Runtime/painting/text_span.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ public RenderComparison compareTo(TextSpan other) {
170170
RenderComparison result = Equals(this.recognizer, other.recognizer)
171171
? RenderComparison.identical
172172
: RenderComparison.metadata;
173+
174+
if (!Equals(this.recognizer, other.recognizer)) {
175+
result = RenderComparison.hoverCallback > result ? RenderComparison.hoverCallback : result;
176+
}
177+
173178
if (this.style != null) {
174179
var candidate = this.style.compareTo(other.style);
175180
if (candidate > result) {

Runtime/rendering/paragraph.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public TextSpan text {
9191
case RenderComparison.identical:
9292
case RenderComparison.metadata:
9393
return;
94+
case RenderComparison.hoverCallback:
95+
this._textPainter.text = value;
96+
break;
9497
case RenderComparison.paint:
9598
this._textPainter.text = value;
9699
this.markNeedsPaint();

0 commit comments

Comments
 (0)