diff --git a/Source/Editor/CustomEditors/Editors/FloatEditor.cs b/Source/Editor/CustomEditors/Editors/FloatEditor.cs
index 523db92cf..63ef35ca9 100644
--- a/Source/Editor/CustomEditors/Editors/FloatEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/FloatEditor.cs
@@ -15,6 +15,11 @@ namespace FlaxEditor.CustomEditors.Editors
{
private IFloatValueEditor _element;
+ ///
+ /// Gets the element.
+ ///
+ public IFloatValueEditor Element => _element;
+
///
public override DisplayStyle Style => DisplayStyle.Inline;
diff --git a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
index 8174a40a6..24f144aed 100644
--- a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
@@ -23,6 +23,7 @@ namespace FlaxEditor.CustomEditors.Editors
new OptionType("Solid Color", typeof(SolidColorBrush)),
new OptionType("Linear Gradient", typeof(LinearGradientBrush)),
new OptionType("Texture 9-Slicing", typeof(Texture9SlicingBrush)),
+ new OptionType("Sprite 9-Slicing", typeof(Sprite9SlicingBrush)),
};
}
}
diff --git a/Source/Editor/CustomEditors/Editors/MarginEditor.cs b/Source/Editor/CustomEditors/Editors/MarginEditor.cs
new file mode 100644
index 000000000..758264330
--- /dev/null
+++ b/Source/Editor/CustomEditors/Editors/MarginEditor.cs
@@ -0,0 +1,35 @@
+// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
+
+using System.Linq;
+using FlaxEngine;
+using FlaxEngine.GUI;
+
+namespace FlaxEditor.CustomEditors.Editors
+{
+ ///
+ /// Default implementation of the inspector used to edit Version value type properties.
+ ///
+ [CustomEditor(typeof(Margin)), DefaultEditor]
+ public class MarginEditor : GenericEditor
+ {
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ base.Initialize(layout);
+
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ var limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ if (limit != null)
+ {
+ for (var i = 0; i < ChildrenEditors.Count; i++)
+ {
+ if (ChildrenEditors[i] is FloatEditor floatEditor)
+ floatEditor.Element.SetLimits(limit);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Source/Editor/CustomEditors/Elements/IFloatValueEditor.cs b/Source/Editor/CustomEditors/Elements/IFloatValueEditor.cs
index 2e67cb5f7..59c0b7a8c 100644
--- a/Source/Editor/CustomEditors/Elements/IFloatValueEditor.cs
+++ b/Source/Editor/CustomEditors/Elements/IFloatValueEditor.cs
@@ -1,5 +1,7 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
+using FlaxEngine;
+
namespace FlaxEditor.CustomEditors.Elements
{
///
@@ -16,5 +18,11 @@ namespace FlaxEditor.CustomEditors.Elements
/// Gets a value indicating whether user is using a slider.
///
bool IsSliding { get; }
+
+ ///
+ /// Sets the editor limits from member .
+ ///
+ /// The limit.
+ void SetLimits(LimitAttribute limit);
}
}
diff --git a/Source/Editor/CustomEditors/Elements/SliderElement.cs b/Source/Editor/CustomEditors/Elements/SliderElement.cs
index 6e981a257..988c86a69 100644
--- a/Source/Editor/CustomEditors/Elements/SliderElement.cs
+++ b/Source/Editor/CustomEditors/Elements/SliderElement.cs
@@ -76,5 +76,14 @@ namespace FlaxEditor.CustomEditors.Elements
///
public bool IsSliding => Slider.IsSliding;
+
+ ///
+ public void SetLimits(LimitAttribute limit)
+ {
+ if (limit != null)
+ {
+ Slider.SetLimits(limit);
+ }
+ }
}
}
diff --git a/Source/Editor/GUI/Input/SliderControl.cs b/Source/Editor/GUI/Input/SliderControl.cs
index 77e8a5da8..d1a2e26d1 100644
--- a/Source/Editor/GUI/Input/SliderControl.cs
+++ b/Source/Editor/GUI/Input/SliderControl.cs
@@ -410,6 +410,17 @@ namespace FlaxEditor.GUI.Input
Value = Value;
}
+ ///
+ /// Sets the limits from the attribute.
+ ///
+ /// The limits.
+ public void SetLimits(LimitAttribute limits)
+ {
+ _min = limits.Min;
+ _max = Mathf.Max(_min, limits.Max);
+ Value = Value;
+ }
+
///
/// Updates the text of the textbox.
///