Skip to content

Commit c1ae86d

Browse files
committed
Disable snapping of text in UI
1 parent 944cae2 commit c1ae86d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Assets/_Project/Prefabs/UI/TimelineVizCanvas.prefab

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/_Project/Scripts/Movement/KeepUIInCameraView.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public class KeepUIInCameraView : MonoBehaviour {
77
RectTransform rect;
88
RectTransform parentRect;
99

10+
// rect width
11+
public float rectWidth;
12+
1013
private void Awake ()
1114
{
1215
rect = GetComponent<RectTransform> ();
@@ -19,10 +22,13 @@ void Update ()
1922
Vector2 thisPos = rect.anchoredPosition;
2023
Vector2 parentPos = parentRect.anchorMax;
2124

25+
rectWidth = rect.sizeDelta.x;
26+
27+
2228
if (parentPos.x < 0.05f) {
23-
thisPos = new Vector3 (100, thisPos.y);
24-
} else if (parentPos.x > 0.95f) {
25-
thisPos = new Vector3 (-100, thisPos.y);
29+
thisPos = new Vector3 (rectWidth / 2, thisPos.y);
30+
} else if (parentPos.x > rect.sizeDelta.x) {
31+
thisPos = new Vector3 (-(rectWidth / 2), thisPos.y);
2632
} else {
2733
thisPos = new Vector3 (0, thisPos.y);
2834
}

0 commit comments

Comments
 (0)