Cleanup 8

This commit is contained in:
W2.Wizard
2021-02-21 14:27:44 +01:00
parent a4409c729b
commit 68f6e0251c
13 changed files with 73 additions and 84 deletions

View File

@@ -123,11 +123,9 @@ namespace FlaxEngine.GUI
return location;
// Transform canvas local-space point to the game root location
Matrix world;
_canvas.GetWorldMatrix(out world);
Vector3 locationWorldSpace;
_canvas.GetWorldMatrix(out Matrix world);
Vector3 locationCanvasSpace = new Vector3(location, 0.0f);
Vector3.Transform(ref locationCanvasSpace, ref world, out locationWorldSpace);
Vector3.Transform(ref locationCanvasSpace, ref world, out Vector3 locationWorldSpace);
camera.ProjectPoint(locationWorldSpace, out location);
return location;
}

View File

@@ -368,9 +368,8 @@ namespace FlaxEngine.GUI
public void UpdateTransform()
{
// Actual pivot and negative pivot
Vector2 v1, v2;
Vector2.Multiply(ref _pivot, ref _bounds.Size, out v1);
Vector2.Negate(ref v1, out v2);
Vector2.Multiply(ref _pivot, ref _bounds.Size, out Vector2 v1);
Vector2.Negate(ref v1, out Vector2 v2);
Vector2.Add(ref v1, ref _bounds.Location, out v1);
// ------ Matrix3x3 based version:
@@ -400,16 +399,14 @@ namespace FlaxEngine.GUI
// ------ Matrix2x2 based version:
// 2D transformation
Matrix2x2 m1, m2;
Matrix2x2.Scale(ref _scale, out m1);
Matrix2x2.Shear(ref _shear, out m2);
Matrix2x2.Scale(ref _scale, out Matrix2x2 m1);
Matrix2x2.Shear(ref _shear, out Matrix2x2 m2);
Matrix2x2.Multiply(ref m1, ref m2, out m1);
Matrix2x2.Rotation(Mathf.DegreesToRadians * _rotation, out m2);
Matrix2x2.Multiply(ref m1, ref m2, out m1);
// Mix all the stuff
Matrix3x3 m3;
Matrix3x3.Translation2D(ref v2, out m3);
Matrix3x3.Translation2D(ref v2, out Matrix3x3 m3);
Matrix3x3 m4 = (Matrix3x3)m1;
Matrix3x3.Multiply(ref m3, ref m4, out m3);
Matrix3x3.Translation2D(ref v1, out m4);

View File

@@ -40,9 +40,7 @@ namespace FlaxEngine.GUI
get => _cellsV;
set
{
if (value == null)
throw new ArgumentNullException();
_cellsV = value;
_cellsV = value ?? throw new ArgumentNullException();
PerformLayout();
}
}
@@ -56,9 +54,7 @@ namespace FlaxEngine.GUI
get => _cellsH;
set
{
if (value == null)
throw new ArgumentNullException();
_cellsH = value;
_cellsH = value ?? throw new ArgumentNullException();
PerformLayout();
}
}

View File

@@ -162,9 +162,7 @@ namespace FlaxEngine.GUI
if (_timeToPopupLeft <= 0.0f)
{
Vector2 location;
Rectangle area;
if (_lastTarget.OnShowTooltip(out _currentText, out location, out area))
if (_lastTarget.OnShowTooltip(out _currentText, out Vector2 location, out Rectangle area))
{
Show(_lastTarget, location, area);
}