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
1 change: 1 addition & 0 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix potential infinite compilation when using subgraphs [Case 1346576](https://issuetracker.unity3d.com/product/unity/issues/guid/1346576/)
- Prevent out of sync serialization of VFX assets that could cause the asset to be dirtied without reason
- Fix undetermitism in space with LocalToWorld and WorldToLocal operators [Case 1355820](https://issuetracker.unity3d.com/product/unity/issues/guid/1355820/)
- No more performance drop when Windows screen DPI setting is set to custom values (like 125%)

## [10.2.0] - 2020-10-19
### Added
Expand Down
24 changes: 19 additions & 5 deletions com.unity.visualeffectgraph/Editor/Utils/VFXSystemBorder.cs
Original file line number Diff line number Diff line change
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,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)
Expand Down