Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 21 additions & 7 deletions com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace UnityEditor.VFX.UI
{
class VFXSystemBorderFactory : UxmlFactory<VFXSystemBorder>
{}
{ }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected change but probably comes from formatting 🤔



class VFXSystemBorder : GraphElement, IControlledElement<VFXSystemController>, IDisposable
Expand Down Expand Up @@ -128,16 +128,28 @@ 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();
}

void UpdateTitleFieldRect()
{
Rect rect = m_Title.layout;

m_Title.parent.ChangeCoordinatesTo(m_TitleField.parent, rect);


Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down