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

View File

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

View File

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