diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index ae830cec92c..9ad132d2b9c 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -119,6 +119,7 @@ The version number for this package has increased due to a version update of a r - Fix undetermitism in space with LocalToWorld and WorldToLocal operators [Case 1355820](https://issuetracker.unity3d.com/product/unity/issues/guid/1355820/) - Added a missing paste option in the context menu for VFX contexts. Also the paste options is now disabled when uneffective - Rename "Material Offset" to "Sorting Priority" in output render state settings [Case 1365257](https://issuetracker.unity3d.com/product/unity/issues/guid/1365257/) +- No more performance drop when Windows screen DPI setting is set to custom values (like 125%) ## [11.0.0] - 2020-10-21 ### Added diff --git a/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs b/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs index a74d0f97ebe..1f43e952135 100644 --- a/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs +++ b/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs @@ -128,8 +128,21 @@ void OnTitleMouseDown(MouseDownEvent e) } } + bool IsDifferenceTooSmall(float x, float y) + { + return Mathf.Abs(x - y) < 1f; + } + void OnTitleRelayout(GeometryChangedEvent e) { + if (IsDifferenceTooSmall(e.oldRect.x, e.newRect.x) && + IsDifferenceTooSmall(e.oldRect.y, e.newRect.y) && + IsDifferenceTooSmall(e.oldRect.width, e.newRect.width) && + IsDifferenceTooSmall(e.oldRect.height, e.newRect.height)) + { + return; + } + UpdateTitleFieldRect(); RecomputeBounds(); } @@ -137,7 +150,6 @@ void OnTitleRelayout(GeometryChangedEvent e) void UpdateTitleFieldRect() { Rect rect = m_Title.layout; - m_Title.parent.ChangeCoordinatesTo(m_TitleField.parent, rect); @@ -191,11 +203,12 @@ public void RecomputeBounds() { if (m_WaitingRecompute) return; + visible = true; //title width should be at least as wide as a context to be valid. float titleWidth = m_Title.layout.width; - bool invalidTitleWidth = float.IsNaN(titleWidth) || titleWidth < 50; - bool titleEmpty = string.IsNullOrEmpty(m_Title.text) || invalidTitleWidth; + bool shouldDeferRecompute = float.IsNaN(titleWidth) || titleWidth < 50; + bool titleEmpty = string.IsNullOrEmpty(m_Title.text) || shouldDeferRecompute; if (titleEmpty) { m_Title.AddToClassList("empty"); @@ -226,11 +239,12 @@ public void RecomputeBounds() } if (float.IsNaN(rect.xMin) || float.IsNaN(rect.yMin) || float.IsNaN(rect.width) || float.IsNaN(rect.height)) + { rect = Rect.zero; + } rect = RectUtils.Inflate(rect, 20, titleEmpty ? 20 : m_Title.layout.height, 20, 20); - - if (invalidTitleWidth) + if (shouldDeferRecompute) { SetPosition(rect); if (!m_WaitingRecompute)