Code cleanup, add tooltip and cache property option in layout #1140

This commit is contained in:
Wojtek Figat
2023-06-09 17:32:57 +02:00
parent 94abdfd734
commit 3bbfe9de8a
4 changed files with 25 additions and 27 deletions

View File

@@ -1,7 +1,6 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
using System.Runtime.Remoting.Messaging;
namespace FlaxEngine.GUI
{
@@ -191,13 +190,12 @@ namespace FlaxEngine.GUI
{
if (Mathf.NearEqual(_bounds.Size.X, value))
return;
var rectLocation = _bounds.Location;
if (PivotRelative)
var bounds = new Rectangle(_bounds.Location, value, _bounds.Size.Y);
if (_pivotRelativeSizing)
{
var delta = _bounds.Size.X - value;
rectLocation.X += delta * Pivot.X;
bounds.Location.X += delta * Pivot.X;
}
var bounds = new Rectangle(rectLocation, value, _bounds.Size.Y);
SetBounds(ref bounds);
}
}
@@ -213,13 +211,12 @@ namespace FlaxEngine.GUI
{
if (Mathf.NearEqual(_bounds.Size.Y, value))
return;
var rectLocation = _bounds.Location;
if (PivotRelative)
var bounds = new Rectangle(_bounds.Location, _bounds.Size.X, value);
if (_pivotRelativeSizing)
{
var delta = _bounds.Size.Y - value;
rectLocation.Y += delta * Pivot.Y;
bounds.Location.Y += delta * Pivot.Y;
}
var bounds = new Rectangle(rectLocation, _bounds.Size.X, value);
SetBounds(ref bounds);
}
}