diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 091c5fb05ad..7dac2623810 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -5,9 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [10.8.0] - 2021-09-20 - -Version Updated -The version number for this package has increased due to a version update of a related graphics package. +### Fixed +- No more performance drop when Windows screen DPI setting is set to custom values (like 125%) ## [10.7.0] - 2021-07-02 ### Fixed diff --git a/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs b/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs index ce8e75aab70..1f43e952135 100644 --- a/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs +++ b/com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs @@ -11,7 +11,7 @@ namespace UnityEditor.VFX.UI { class VFXSystemBorderFactory : UxmlFactory - {} + { } class VFXSystemBorder : GraphElement, IControlledElement, IDisposable @@ -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,17 +239,18 @@ 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) { m_WaitingRecompute = true; - schedule.Execute(() => { m_WaitingRecompute = false; RecomputeBounds(); }).ExecuteLater(0); // title height might have changed if width have changed + schedule.Execute(() => { m_WaitingRecompute = false; RecomputeBounds(); }).ExecuteLater(0); // title height might have changed if width have changed } } else