Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 49bce65

Browse files
committed
Fix text clipping with transform cell name and sibling index
1 parent bd9e80f commit 49bce65

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/UI/Widgets/TransformTree/TransformCell.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public GameObject CreateContent(GameObject parent)
153153
Rect.sizeDelta = new Vector2(25, 25);
154154
UIFactory.SetLayoutElement(UIRoot, minWidth: 100, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
155155

156-
var spacerObj = UIFactory.CreateUIObject("Spacer", UIRoot, new Vector2(0, 0));
156+
GameObject spacerObj = UIFactory.CreateUIObject("Spacer", UIRoot, new Vector2(0, 0));
157157
UIFactory.SetLayoutElement(spacerObj, minWidth: 0, flexibleWidth: 0, minHeight: 0, flexibleHeight: 0);
158158
this.spacer = spacerObj.GetComponent<LayoutElement>();
159159

@@ -164,15 +164,20 @@ public GameObject CreateContent(GameObject parent)
164164

165165
// Enabled toggle
166166

167-
var toggleObj = UIFactory.CreateToggle(UIRoot, "BehaviourToggle", out EnabledToggle, out var behavText, default, 17, 17);
167+
GameObject toggleObj = UIFactory.CreateToggle(UIRoot, "BehaviourToggle", out EnabledToggle, out Text behavText, default, 17, 17);
168168
UIFactory.SetLayoutElement(toggleObj, minHeight: 17, flexibleHeight: 0, minWidth: 17);
169169
EnabledToggle.onValueChanged.AddListener(OnEnableClicked);
170170

171171
// Name button
172172

173-
NameButton = UIFactory.CreateButton(this.UIRoot, "NameButton", "Name", null);
173+
GameObject nameBtnHolder = UIFactory.CreateHorizontalGroup(this.UIRoot, "NameButtonHolder",
174+
false, false, true, true, childAlignment: TextAnchor.MiddleLeft);
175+
UIFactory.SetLayoutElement(nameBtnHolder, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
176+
nameBtnHolder.AddComponent<Mask>().showMaskGraphic = false;
177+
178+
NameButton = UIFactory.CreateButton(nameBtnHolder, "NameButton", "Name", null);
174179
UIFactory.SetLayoutElement(NameButton.Component.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
175-
var nameLabel = NameButton.Component.GetComponentInChildren<Text>();
180+
Text nameLabel = NameButton.Component.GetComponentInChildren<Text>();
176181
nameLabel.horizontalOverflow = HorizontalWrapMode.Overflow;
177182
nameLabel.alignment = TextAnchor.MiddleLeft;
178183

@@ -181,7 +186,7 @@ public GameObject CreateContent(GameObject parent)
181186
SiblingIndex = UIFactory.CreateInputField(this.UIRoot, "SiblingIndexInput", string.Empty);
182187
SiblingIndex.Component.textComponent.fontSize = 11;
183188
SiblingIndex.Component.textComponent.alignment = TextAnchor.MiddleRight;
184-
var siblingImage = SiblingIndex.GameObject.GetComponent<Image>();
189+
Image siblingImage = SiblingIndex.GameObject.GetComponent<Image>();
185190
siblingImage.color = new(0f, 0f, 0f, 0.25f);
186191
UIFactory.SetLayoutElement(SiblingIndex.GameObject, 35, 20, 0, 0);
187192
SiblingIndex.Component.GetOnEndEdit().AddListener(OnSiblingIndexEndEdit);

0 commit comments

Comments
 (0)