New button styling
This commit is contained in:
@@ -487,10 +487,37 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
BuildLocationSizeOffsets(horUp, horDown, _cachedXEq, _cachedYEq, valueTypes);
|
||||
|
||||
BuildExtraButtons(group);
|
||||
|
||||
main.Space(10);
|
||||
BuildAnchorsDropper(main, valueTypes);
|
||||
}
|
||||
|
||||
private void BuildExtraButtons(VerticalPanelElement group)
|
||||
{
|
||||
var panel = group.CustomContainer<Panel>();
|
||||
panel.CustomControl.Height = TextBoxBase.DefaultHeight;
|
||||
panel.CustomControl.ClipChildren = false;
|
||||
panel.CustomControl.Parent = group.ContainerControl;
|
||||
panel.CustomControl.Y += 50;
|
||||
|
||||
var pivotSizeRelativeBtn = new Button()
|
||||
{
|
||||
Parent = panel.ContainerControl,
|
||||
Width = 18,
|
||||
Height = 18,
|
||||
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Scale32),
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
};
|
||||
pivotSizeRelativeBtn.Clicked += () =>
|
||||
{
|
||||
var current = (Values[0] as Control).PivotRelative;
|
||||
(Values[0] as Control).PivotRelative = !current;
|
||||
pivotSizeRelativeBtn.BorderColor = current ? Color.Transparent : Color.AliceBlue;
|
||||
pivotSizeRelativeBtn.BackgroundColor = current ? Color.Gray : Color.White;
|
||||
};
|
||||
}
|
||||
|
||||
private void BuildAnchorsDropper(LayoutElementsContainer main, ScriptType[] valueTypes)
|
||||
{
|
||||
ScriptMemberInfo minInfo = valueTypes[0].GetProperty("AnchorMin");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -172,8 +173,12 @@ namespace FlaxEngine.GUI
|
||||
/// <summary>
|
||||
/// Whether to resize the UI Control based on where the pivot is rather than just the top-left.
|
||||
/// </summary>
|
||||
[ExpandGroups, EditorDisplay("Transform"), EditorOrder(1060)]
|
||||
public bool PivotRelative = false;
|
||||
[NoSerialize, HideInEditor]
|
||||
public bool PivotRelative
|
||||
{
|
||||
get => _pivotRelativeSizing;
|
||||
set => _pivotRelativeSizing = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets width of the control.
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace FlaxEngine.GUI
|
||||
private float _rotation;
|
||||
internal Matrix3x3 _cachedTransform;
|
||||
internal Matrix3x3 _cachedTransformInv;
|
||||
private bool _pivotRelativeSizing = false;
|
||||
|
||||
// Style
|
||||
|
||||
|
||||
Reference in New Issue
Block a user