浏览代码

Remove checks for within parent bonds in resize handles

/main
Jens Holm 6 年前
当前提交
43f24a85
共有 4 个文件被更改,包括 1 次插入39 次删除
  1. 1
      com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs
  2. 1
      com.unity.shadergraph/Editor/Drawing/Inspector/MasterPreviewView.cs
  3. 17
      com.unity.shadergraph/Editor/Drawing/Manipulators/ResizeBorderFrame.cs
  4. 21
      com.unity.shadergraph/Editor/Drawing/Manipulators/ResizeSideHandle.cs

1
com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs


blackboard.AddManipulator(m_WindowDraggable);
m_ResizeBorderFrame = new ResizeBorderFrame(blackboard) { name = "resizeBorderFrame" };
m_ResizeBorderFrame.stayWithinParentBounds = true;
blackboard.shadow.Add(m_ResizeBorderFrame);
m_Section = new BlackboardSection { headerVisible = false };

1
com.unity.shadergraph/Editor/Drawing/Inspector/MasterPreviewView.cs


Add(preview);
m_PreviewResizeBorderFrame = new ResizeBorderFrame(previewTextureView, this) { name = "resizeBorderFrame" };
m_PreviewResizeBorderFrame.stayWithinParentBounds = true;
m_PreviewResizeBorderFrame.maintainAspectRatio = true;
Add(m_PreviewResizeBorderFrame);

17
com.unity.shadergraph/Editor/Drawing/Manipulators/ResizeBorderFrame.cs


{
List<ResizeSideHandle> m_ResizeSideHandles;
bool m_StayWithinParentBounds;
public bool stayWithinParentBounds
{
get { return m_StayWithinParentBounds; }
set
{
m_StayWithinParentBounds = value;
foreach (ResizeSideHandle resizeHandle in m_ResizeSideHandles)
{
resizeHandle.stayWithinParentBounds = value;
}
}
}
bool m_MaintainApsectRatio;
public bool maintainAspectRatio

m_ResizeSideHandles = new List<ResizeSideHandle>();
// Add resize handles along the border
// Add resize handles along the border
m_ResizeSideHandles.Add(new ResizeSideHandle(target, container, ResizeHandleAnchor.TopLeft));
m_ResizeSideHandles.Add(new ResizeSideHandle(target, container, ResizeHandleAnchor.Top));
m_ResizeSideHandles.Add(new ResizeSideHandle(target, container, ResizeHandleAnchor.TopRight));

21
com.unity.shadergraph/Editor/Drawing/Manipulators/ResizeSideHandle.cs


WindowDockingLayout m_WindowDockingLayout;
bool m_StayWithinParentBounds;
public bool stayWithinParentBounds
{
get { return m_StayWithinParentBounds; }
set { m_StayWithinParentBounds = value; }
}
bool m_MaintainAspectRatio;
public bool maintainAspectRatio

void InitialLayoutSetup(GeometryChangedEvent evt)
{
m_ResizeTarget.UnregisterCallback<GeometryChangedEvent>(InitialLayoutSetup);
}
Vector2 BoundedMousePosition(Vector2 mousePosition)
{
mousePosition = m_Container.parent.WorldToLocal(mousePosition);
if (!stayWithinParentBounds)
return mousePosition;
mousePosition.x = Mathf.Clamp(mousePosition.x, 5f, m_Container.parent.layout.width);
mousePosition.y = Mathf.Clamp(mousePosition.y, 5f, m_Container.parent.layout.height);
return mousePosition;
}
void HandleResizeFromTop(MouseMoveEvent mouseMoveEvent)

正在加载...
取消
保存