浏览代码

Remove resize function from GraphInspectorView

/main
Jens Holm 7 年前
当前提交
2587263f
共有 1 个文件被更改,包括 0 次插入38 次删除
  1. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs

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


Add(new ResizeSideHandle(this, ResizeHandleAnchor.Left, new string[] {"resize", "horizontal", "left"}));
}
void OnResize(Vector2 resizeDelta, ResizeDirection direction, bool moveWhileResize)
{
Vector2 normalizedResizeDelta = resizeDelta / 2f;
if (direction == ResizeDirection.Vertical)
{
normalizedResizeDelta.x = 0f;
}
else if (direction == ResizeDirection.Horizontal)
{
normalizedResizeDelta.y = 0f;
}
Rect newLayout = layout;
// Resize form bottom/right
if (!moveWhileResize)
{
newLayout.width = Mathf.Max(layout.width + normalizedResizeDelta.x, 60f);
newLayout.height = Mathf.Max(layout.height + normalizedResizeDelta.y, 60f);
layout = newLayout;
return;
}
float previousFarX = layout.x + layout.width;
float previousFarY = layout.y + layout.height;
newLayout.width = Mathf.Max(layout.width - normalizedResizeDelta.x, 60f);
newLayout.height = Mathf.Max(layout.height - normalizedResizeDelta.y, 60f);
newLayout.x = Mathf.Min(layout.x + normalizedResizeDelta.x, previousFarX - 60f);
newLayout.y = Mathf.Min(layout.y + normalizedResizeDelta.y, previousFarY - 60f);
layout = newLayout;
}
MasterNode masterNode
{
get { return m_PreviewRenderHandle.shaderData.node as MasterNode; }

正在加载...
取消
保存