Improve UI style

This commit is contained in:
Pascal Serrarens 2026-01-09 12:06:49 +01:00
parent f8dc4dc5d3
commit 1b5a86ce55
3 changed files with 625 additions and 634 deletions

View File

@ -20,9 +20,9 @@ public class NanoBrainInspector : Editor {
serializedObject.Update(); serializedObject.Update();
VisualElement root = new(); VisualElement root = new();
root.style.flexDirection = FlexDirection.Column; // side-by-side layout //root.style.flexDirection = FlexDirection.Row; // side-by-side layout
root.style.flexGrow = 1; //root.style.flexGrow = 1;
root.style.minHeight = 600; //root.style.minHeight = 600;
root.style.paddingLeft = 0; root.style.paddingLeft = 0;
root.style.paddingRight = 0; root.style.paddingRight = 0;
root.style.paddingTop = 0; root.style.paddingTop = 0;
@ -31,25 +31,21 @@ public class NanoBrainInspector : Editor {
root.styleSheets.Add(Resources.Load<StyleSheet>("GraphStyles")); root.styleSheets.Add(Resources.Load<StyleSheet>("GraphStyles"));
mainContainer = new() { mainContainer = new() {
name = "main", // name = "main",
style = { style = {
flexDirection = FlexDirection.Row, // flexDirection = FlexDirection.Row,
flexGrow = 1, // flexGrow = 1,
minHeight = 500, height = 450,
} }
}; };
GraphView board; GraphView graph = new();
board = new GraphView(); graph.style.flexGrow = 1;
board.style.flexGrow = 1;
inspectorContainer = new VisualElement { inspectorContainer = new VisualElement {
name = "inspector", // name = "inspector"
style = {
width = 400,
}
}; };
mainContainer.Add(board); mainContainer.Add(graph);
mainContainer.Add(inspectorContainer); mainContainer.Add(inspectorContainer);
root.Add(mainContainer); root.Add(mainContainer);
@ -63,7 +59,7 @@ public class NanoBrainInspector : Editor {
}); });
if (brain != null) if (brain != null)
board.SetGraph(null, brain, brain.root, inspectorContainer); graph.SetGraph(null, brain, brain.root, inspectorContainer);
else else
Debug.LogWarning(" No brain!"); Debug.LogWarning(" No brain!");
@ -574,9 +570,9 @@ public class NanoBrainInspector : Editor {
#region Update #region Update
private void UpdateLayout(float containerWidth) { private void UpdateLayout(float containerWidth) {
if (containerWidth > 700f) { if (containerWidth > 600f) {
mainContainer.style.flexDirection = FlexDirection.Row; mainContainer.style.flexDirection = FlexDirection.Row;
inspectorContainer.style.width = 400; // fixed sidebar width inspectorContainer.style.width = 300; // fixed sidebar width
inspectorContainer.style.flexGrow = 0; inspectorContainer.style.flexGrow = 0;
} }
else { else {

View File

@ -1,15 +1,12 @@
#main {
}
#content { #content {
background-color: #2b2b2b, background-color: #2b2b2b;
position: absolute;
} }
#inspector { #inspector {
border-left-width: 1px; border-left-width: 1px;
border-left-color: #000; border-left-color: #000;
border-left_style: solid;
padding: 3px; padding: 3px;
} }
.node { background-color: #222; border-radius:4px; padding:6px; } #title {
#title { unity-font-style: bold; color: white; } -unity-font-style: bold;
color: white;
}

View File

@ -58,9 +58,7 @@ GraphicsSettings:
m_FogKeepExp2: 1 m_FogKeepExp2: 1
m_AlbedoSwatchInfos: [] m_AlbedoSwatchInfos: []
m_RenderPipelineGlobalSettingsMap: m_RenderPipelineGlobalSettingsMap:
UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 2acc6984d25d4a508a6d7042927d3083, type: 2} UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 370d27fa5af5291e18529fa336759ac9, type: 2}
m_ShaderBuildSettings:
keywordDeclarationOverrides: []
m_LightsUseLinearIntensity: 1 m_LightsUseLinearIntensity: 1
m_LightsUseColorTemperature: 1 m_LightsUseColorTemperature: 1
m_LogWhenShaderIsCompiled: 0 m_LogWhenShaderIsCompiled: 0