Skip to content

Commit

Permalink
Shrink operator if possible (when changing data type) (Unity-Technolo…
Browse files Browse the repository at this point in the history
…gies#6668)

* Shrink operator if possible (when changing data type)

* Updated changelog

* Reset minwidth when the operator is expanded (so that it can shrink if possible)
  • Loading branch information
julienamsellem committed Jan 14, 2022
1 parent 63bf094 commit 0ac6a5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed GPU event particle init after restarting VisualEffect [Case 1378335](https://issuetracker.unity3d.com/product/unity/issues/guid/1378335/)
- No more exception raised when selecting all nodes with CTRL+A and then deleting them
- Particle Strip without lifetime do not die when Alive is set to false. [Case 1376278](https://issuetracker.unity3d.com/product/unity/issues/guid/1376278/)
- Resize custom operator (multiply, add...) to the minimum size when changing input types

## [13.1.2] - 2021-11-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void OnEdit()
if (m_EditContainer.parent != null)
{
m_EditContainer.RemoveFromHierarchy();
style.minWidth = 0;
}
else
{
Expand Down Expand Up @@ -212,20 +213,22 @@ public override void RefreshLayout()

ApplyWidths(labelWidth, controlWidth);

// Do not let the UI reduce in width so that collapse button does not move
var newMinWidth = resolvedStyle.width;
if (resolvedStyle.minWidth.value < newMinWidth)
// To prevent width to change between expanded and collapsed state
// we set the minwidth to actual width before collapse, and reset to zero when expand
// so that the expand/collapse button does not move
if (!expanded)
{
style.minWidth = newMinWidth;
}
}
else
{
if (resolvedStyle.minWidth != 0f)
{
style.minWidth = 0f;
var newMinWidth = resolvedStyle.width;
if (resolvedStyle.minWidth.value < newMinWidth)
{
style.minWidth = newMinWidth;
}

return;
}
}

style.minWidth = 0f;
}
}
}

0 comments on commit 0ac6a5e

Please sign in to comment.