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

Commit ba811f7

Browse files
author
Yuncong Zhang
committed
Cleanup.
1 parent b0f6491 commit ba811f7

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Runtime/ui/painting/txt/text_blob.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
namespace Unity.UIWidgets.ui {
22
public struct TextBlob {
3+
34
internal TextBlob(string text, int textOffset, int textSize, float[] positions,
45
UnityEngine.Rect bounds, TextStyle style) {
56
this.instanceId = ++_nextInstanceId;
7+
this._positions = positions;
68
this.text = text;
79
this.textOffset = textOffset;
810
this.textSize = textSize;
911
this.style = style;
1012
this._bounds = bounds;
11-
this._positions = positions;
1213
}
1314

1415
public Rect boundsInText {
1516
get {
16-
var pos = this._positions[this.textOffset];
17-
return Rect.fromLTWH(this._bounds.xMin + pos, this._bounds.yMin, this._bounds.width, this._bounds.height);
17+
var pos = this.getPosition(0);
18+
return Rect.fromLTWH(this._bounds.xMin + pos, this._bounds.yMin,
19+
this._bounds.width, this._bounds.height);
1820
}
1921
}
2022

2123
public Rect shiftedBoundsInText(Offset offset) {
22-
var pos = this._positions[this.textOffset];
23-
return Rect.fromLTWH(this._bounds.xMin + pos + offset.dx, this._bounds.yMin + offset.dy, this._bounds.width, this._bounds.height);
24+
var pos = this.getPosition(0);
25+
return Rect.fromLTWH(this._bounds.xMin + pos + offset.dx, this._bounds.yMin + offset.dy,
26+
this._bounds.width, this._bounds.height);
2427
}
2528

2629
public float getPosition(int i) {

Runtime/ui/txt/linebreaker.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System.Collections.Generic;
2-
using Unity.UIWidgets.foundation;
3-
using Unity.UIWidgets.InternalBridge;
42
using UnityEngine;
53

64
namespace Unity.UIWidgets.ui {

Runtime/ui/txt/wordbreaker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static bool isTrailSurrogate(uint c) {
163163
}
164164

165165
public static uint getSupplementary(uint lead, uint trail) {
166-
return (char) (( lead << 10) + (trail - U16_SURROGATE_OFFSET));
166+
return (char) ((lead << 10) + (trail - U16_SURROGATE_OFFSET));
167167
}
168168

169169
public static bool isBoundaryChar(char code) {

0 commit comments

Comments
 (0)