Skip to content

Commit 328c9f7

Browse files
committed
Text centering + title on-change
1 parent 1b286fb commit 328c9f7

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

Editor/DataVisualizer/DataVisualizer.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,6 +4068,37 @@ private void HandleOdinPropertyValueChanged(InspectorProperty property, int sele
40684068
}
40694069
#endif
40704070

4071+
private void ListenForPropertyChange(InspectorElement inspectorElement)
4072+
{
4073+
if (_currentInspectorScriptableObject == null)
4074+
{
4075+
return;
4076+
}
4077+
4078+
SerializedProperty property = _currentInspectorScriptableObject.FindProperty(
4079+
nameof(BaseDataObject._title)
4080+
);
4081+
if (property == null)
4082+
{
4083+
property = _currentInspectorScriptableObject.FindProperty(
4084+
nameof(IDisplayable.Title)
4085+
);
4086+
if (property == null)
4087+
{
4088+
return;
4089+
}
4090+
}
4091+
inspectorElement.TrackPropertyValue(
4092+
property,
4093+
_ =>
4094+
{
4095+
rootVisualElement
4096+
.schedule.Execute(() => RefreshSelectedElementVisuals(_selectedObject))
4097+
.ExecuteLater(1);
4098+
}
4099+
);
4100+
}
4101+
40714102
private void BuildConfirmNamespaceAddPopoverContent(
40724103
string namespaceKey,
40734104
List<Type> typesToAdd
@@ -4627,6 +4658,7 @@ out CustomDataVisualizationAttribute customVisualization
46274658
}
46284659

46294660
InspectorElement inspectorElement = new(_selectedObject);
4661+
ListenForPropertyChange(inspectorElement);
46304662
_inspectorContainer.Add(inspectorElement);
46314663
}
46324664
catch (Exception e)

Editor/DataVisualizer/Styles/DataVisualizerStyles.uss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626

2727
.object-item__label {
2828
flex-grow: 1;
29+
-unity-text-align: middle-left;
30+
align-content: center;
2931
flex-shrink: 1;
3032
min-width: 0;
3133
white-space: nowrap;
3234
overflow: hidden;
3335
text-overflow: ellipsis;
3436
margin-right: 5px;
3537
margin-left: 5px;
36-
height: 20px;
37-
padding-top: 2px;
3838
}
3939

4040
.bold {
@@ -264,6 +264,7 @@
264264
.namespace-item__label {
265265
flex-grow: 1;
266266
flex-shrink: 1;
267+
-unity-text-align: middle-left;
267268
min-width: 0;
268269
white-space: nowrap;
269270
overflow: hidden;
@@ -309,6 +310,7 @@
309310
.type-item__label {
310311
flex-grow: 1;
311312
flex-shrink: 1;
313+
-unity-text-align: middle-left;
312314
min-width: 0;
313315
white-space: nowrap;
314316
overflow: hidden;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.wallstop-studios.data-visualizer",
3-
"version": "0.0.35-rc04.5",
3+
"version": "0.0.35-rc04.6",
44
"displayName": "Data Visualizer",
55
"description": "Data Management UI for Unity's Scriptable Objects",
66
"dependencies": {},
@@ -51,5 +51,6 @@
5151

5252

5353

54+
5455

5556

0 commit comments

Comments
 (0)