浏览代码

Make master preview collapse relative to mouse position and afterwards recalculate new docking position

/main
Jens Holm 7 年前
当前提交
f3467681
共有 2 个文件被更改,包括 18 次插入3 次删除
  1. 18
      com.unity.shadergraph/Editor/Drawing/Inspector/MasterPreviewView.cs
  2. 3
      com.unity.shadergraph/Editor/Drawing/Manipulators/WindowDraggable.cs

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


RemoveFromClassList("collapsed");
AddToClassList("expanded");
m_PreviewResizeBorderFrame.visible = true;
style.positionLeft = StyleValue<float>.Create(float.NaN);
style.positionBottom = StyleValue<float>.Create(float.NaN);
style.positionRight = StyleValue<float>.Create(parent.layout.width - layout.xMax);
style.positionTop = StyleValue<float>.Create(layout.yMin);
previewTextureView.style.width = StyleValue<float>.Create(m_ExpandedPreviewSize.x);
previewTextureView.style.height = StyleValue<float>.Create(m_ExpandedPreviewSize.y);
}

m_PreviewResizeBorderFrame.visible = false;
style.positionLeft = StyleValue<float>.Create(float.NaN);
style.positionBottom = StyleValue<float>.Create(float.NaN);
style.positionRight = StyleValue<float>.Create(parent.layout.width - layout.xMax);
style.positionTop = StyleValue<float>.Create(layout.yMin);
previewTextureView.style.width = StyleValue<float>.Create(0f);
previewTextureView.style.height = StyleValue<float>.Create(0f);
RemoveFromClassList("expanded");

var currentWidth = m_PreviewRenderHandle.texture != null ? m_PreviewRenderHandle.texture.width : -1;
var currentHeight = m_PreviewRenderHandle.texture != null ? m_PreviewRenderHandle.texture.height : -1;
var targetWidth = m_PreviewTextureView.contentRect.width;
var targetHeight = m_PreviewTextureView.contentRect.height;
var targetWidth = Mathf.Max(1f, m_PreviewTextureView.contentRect.width);
var targetHeight = Mathf.Max(1f, m_PreviewTextureView.contentRect.height);
m_PreviewManager.ResizeMasterPreview(m_PreviewTextureView.contentRect.size);
m_PreviewManager.ResizeMasterPreview(new Vector2(targetWidth, targetHeight));
}
public void UpdateRenderTextureOnNextLayoutChange()

3
com.unity.shadergraph/Editor/Drawing/Manipulators/WindowDraggable.cs


target.style.positionBottom = StyleValue<float>.Create(0f);
}
}
m_WindowDockingLayout.CalculateDockingCornerAndOffset(target.layout, target.parent.layout);
m_WindowDockingLayout.ApplyPosition(target);
}
}
}
正在加载...
取消
保存