Skip to content

Commit 119670f

Browse files
julienamsellemEvergreen
authored andcommitted
|VFX] Blackboard not visible when docked in small area
Jira: UUM-65513 Reproduction steps: 1. Open the attached “VFX.zip” project 2. Open the “graph” asset from the Project Window 3. Dock the “graph” Window to the bottom of the UI Expected result: Floating panel is visible Actual result: Floating panel disappears Reproducible with: 2021.3.35f1, 2022.3.21f1, 2023.2.0a23, 2023.2.13f1 Not reproducible with: 2023.3.0b10 Fixed in: 2023.3.0a2 Reproducible on: Windows 11 Not reproducible on: no other environment tested Note: The 2023.3.0a1 version does not exist therefore cannot be tested Reproducible on any new project Issue appears if the floating panel is placed in the bottom left corner Downgrading from versions where it worked correctly, would usually fix the issue ![video](https://jira.unity3d.com/secure/attachment/1397173/IN-69565%20repro.mkv)
1 parent ecd284f commit 119670f

File tree

3 files changed

+17
-42
lines changed

3 files changed

+17
-42
lines changed

Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
using System.Globalization;
55
using UnityEditor.Experimental;
66
using UnityEditor.Experimental.GraphView;
7-
using UnityEditor.SceneManagement;
87

9-
using UnityEditor.VFX.UIElements;
108
using UnityEngine;
119
using UnityEngine.VFX;
1210
using UnityEngine.UIElements;
@@ -71,51 +69,25 @@ public static void SavePosition(Board board, Rect r)
7169

7270
public static void ValidatePosition(GraphElement element, VFXView view, Rect defaultPosition)
7371
{
74-
Rect viewrect = view.contentRect;
75-
Rect rect = element.GetPosition();
76-
bool changed = false;
72+
var viewrect = view.contentRect;
73+
var rect = element.GetPosition();
74+
var changed = false;
7775

78-
Vector2 maxSizeInView = viewrect.max;
79-
float newWidth = Mathf.Max(defaultPosition.width, Mathf.Min(rect.width, maxSizeInView.x));
80-
float newHeight = Mathf.Max(defaultPosition.height, Mathf.Min(rect.height, maxSizeInView.y));
81-
82-
if (Mathf.Abs(newWidth - rect.width) > 1)
83-
{
84-
rect.width = newWidth;
85-
changed = true;
86-
}
87-
88-
if (Mathf.Abs(newHeight - rect.height) > 1)
76+
if (rect.xMin > viewrect.xMax || rect.xMax > viewrect.xMax)
8977
{
90-
rect.height = newHeight;
78+
var width = Math.Max(Math.Min(rect.width, viewrect.width), element.resolvedStyle.minWidth.value);
79+
rect.xMax = viewrect.xMax;
80+
rect.xMin = Math.Max(0, rect.xMax - width);
81+
rect.width = width;
9182
changed = true;
9283
}
9384

94-
var xDiff = viewrect.xMax - rect.xMax;
95-
if (xDiff < 0)
85+
if (rect.yMin > viewrect.yMax || rect.yMax > viewrect.yMax)
9686
{
97-
if (rect.x + xDiff >= 0)
98-
{
99-
rect.x += xDiff;
100-
}
101-
else
102-
{
103-
rect.width = Math.Max(defaultPosition.width, rect.width + xDiff);
104-
}
105-
changed = true;
106-
}
107-
108-
var yDiff = viewrect.yMax - rect.yMax;
109-
if (yDiff < 0)
110-
{
111-
if (rect.y + yDiff >= 0)
112-
{
113-
rect.y += yDiff;
114-
}
115-
else
116-
{
117-
rect.height = Math.Max(defaultPosition.height, rect.height + yDiff);
118-
}
87+
var height = Math.Max(Math.Min(rect.height, viewrect.height), element.resolvedStyle.minHeight.value);
88+
rect.yMax = viewrect.yMax;
89+
rect.yMin = Math.Max(0, rect.yMax - height);
90+
rect.height = height;
11991
changed = true;
12092
}
12193

Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlackboard.uss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
VFXBlackboard.blackboard
22
{
33
background-color: #292929;
4+
min-height: 200px;
5+
min-width: 250px;
46
}
57

68
/* This margin is to leave some space around the blackboard for the resizer element to grab the mouse */
79
VFXBlackboard.blackboard .mainContainer {
8-
margin: 1px 3px;
10+
margin: 4px;
911
}
1012

1113
VFXBlackboard.blackboard > .mainContainer > #content > #header {

Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXComponentBoard.uss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VFXComponentBoard.graphElement
99

1010
VFXComponentBoard.graphElement > .mainContainer
1111
{
12+
margin: 4px;
1213
flex: 1 1 auto;
1314
background-color: #2b2b2b;
1415
border-color: #191919;

0 commit comments

Comments
 (0)