Skip to content
Merged
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 @@ -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
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