浏览代码

Add resize handle to inspector window

/main
Jens Holm 7 年前
当前提交
82f3473f
共有 3 个文件被更改,包括 28 次插入5 次删除
  1. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  3. 17
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


{
// { typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeEditorView) }
};
var resizeHandle = new Label { name = "resize", text = "" };
resizeHandle.AddManipulator(new Draggable(OnResize));
Add(resizeHandle);
}
void OnResize(Vector2 resizeDelta)
{
Vector2 normalizedResizeDelta = resizeDelta / 2f;
style.width = Mathf.Max(style.width + normalizedResizeDelta.x, 60f);
style.height = Mathf.Max(style.height + normalizedResizeDelta.y, 60f);
}
MasterNode masterNode

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


{
Vector2 normalizedDelta = mouseDelta / 2f;
m_GraphInspectorView.style.positionRight -= normalizedDelta.x;
m_GraphInspectorView.style.positionBottom -= normalizedDelta.y;
m_GraphInspectorView.style.positionLeft += normalizedDelta.x;
m_GraphInspectorView.style.positionTop += normalizedDelta.y;
}
GraphViewChange GraphViewChanged(GraphViewChange graphViewChange)

17
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss


flex-direction: column;
justify-content: space-between;
position-type: absolute;
position-right: 0;
position-bottom: 0;
width: 400;
position-left: 0;
position-top: 0;
width: 600;
height: 800;
}

GraphInspectorView > #bottom > #properties > #items {
padding-bottom: 4;
}
GraphInspectorView > #resize {
cursor: resize-up-left;
align-self: flex-end;
background-color: rgb(0, 0, 127);
position-type: absolute;
width: 16;
height: 16;
position-right: 0;
position-bottom: 0;
}
ShaderPropertyView {

正在加载...
取消
保存