diff --git a/LemonUI/Menus/NativeItem.cs b/LemonUI/Menus/NativeItem.cs
index a36969b..9bbbd7c 100644
--- a/LemonUI/Menus/NativeItem.cs
+++ b/LemonUI/Menus/NativeItem.cs
@@ -393,7 +393,7 @@ public virtual void UpdateColors()
badgeRight.Color = Colors.BadgeRightDisabled;
}
}
- else if (lastSelected)
+ else if (lastSelected && !(this is NativeSeparatorItem))
{
background.Color = Colors.BackgroundHovered;
title.Color = Colors.TitleHovered;
diff --git a/LemonUI/Menus/NativeMenu.cs b/LemonUI/Menus/NativeMenu.cs
index c941294..758480d 100644
--- a/LemonUI/Menus/NativeMenu.cs
+++ b/LemonUI/Menus/NativeMenu.cs
@@ -1282,8 +1282,13 @@ private void ProcessControls()
}
// If the cursor is inside of the selection rectangle
- if (GameScreen.IsCursorInArea(item.title.Position.X - itemOffsetX, item.title.Position.Y - itemOffsetY, Width, itemHeight))
+ if (item.IsHovered)
{
+ if (item is NativeSeparatorItem)
+ {
+ return;
+ }
+
// If the item is selected, activate it
if (item == selectedItem)
{
@@ -1426,7 +1431,7 @@ private void Draw()
continue;
}
- if (item.IsHovered && UseMouse)
+ if (item.IsHovered && UseMouse && !(item is NativeSeparatorItem))
{
hoveredRect.Position = item.lastPosition;
hoveredRect.Size = item.lastSize;
@@ -1774,21 +1779,34 @@ public void Back()
///
public void Previous()
{
- // If there are no items, return
if (Items.Count == 0)
{
return;
}
- // If we are on the first item, go back to the last one
- if (SelectedIndex <= 0)
- {
- SelectedIndex = Items.Count - 1;
- }
- // Otherwise, reduce it by one
- else
+ int nextIndex = SelectedIndex;
+
+ while (true)
{
- SelectedIndex -= 1;
+ nextIndex -= 1;
+
+ if (nextIndex < 0)
+ {
+ nextIndex = Items.Count - 1;
+ }
+
+ if (Items[nextIndex] is NativeSeparatorItem)
+ {
+ continue;
+ }
+
+ if (nextIndex == SelectedIndex)
+ {
+ return;
+ }
+
+ SelectedIndex = nextIndex;
+ return;
}
}
///
@@ -1797,21 +1815,34 @@ public void Previous()
///
public void Next()
{
- // If there are no items, return
if (Items.Count == 0)
{
return;
}
- // If we are on the last item, go back to the first one
- if (Items.Count - 1 == SelectedIndex)
- {
- SelectedIndex = 0;
- }
- // Otherwise, increase it by one
- else
+ int nextIndex = SelectedIndex;
+
+ while (true)
{
- SelectedIndex += 1;
+ nextIndex += 1;
+
+ if (nextIndex >= Items.Count)
+ {
+ nextIndex = 0;
+ }
+
+ if (Items[nextIndex] is NativeSeparatorItem)
+ {
+ continue;
+ }
+
+ if (nextIndex == SelectedIndex)
+ {
+ return;
+ }
+
+ SelectedIndex = nextIndex;
+ return;
}
}
diff --git a/LemonUI/Menus/NativeSeparatorItem.cs b/LemonUI/Menus/NativeSeparatorItem.cs
index 2633e54..0e9526a 100644
--- a/LemonUI/Menus/NativeSeparatorItem.cs
+++ b/LemonUI/Menus/NativeSeparatorItem.cs
@@ -1,28 +1,51 @@
-namespace LemonUI.Menus
+#if FIVEM
+using CitizenFX.Core.UI;
+#elif RAGEMP
+using RAGE.Game;
+#elif SHVDN3 || SHVDNC
+using GTA.UI;
+#endif
+using System.Drawing;
+
+namespace LemonUI.Menus
{
///
- /// A Blank Separator Item for creating empty spaces between menu items.
+ /// An item used to have a space between the items with text or no text.
///
public class NativeSeparatorItem : NativeItem
{
#region Constructors
///
- /// Creates a new Menu Separator.
+ /// Creates a new separator.
+ ///
+ public NativeSeparatorItem() : this(string.Empty)
+ {
+ }
+ ///
+ /// Creates a new separator with a specific title.
///
- public NativeSeparatorItem() : base(string.Empty, string.Empty, string.Empty)
+ /// The title of the item.
+ public NativeSeparatorItem(string title) : base(title, string.Empty, string.Empty)
{
+ this.title.Alignment = Alignment.Center;
}
#endregion
#region Functions
- ///
- /// Draws nothing.
- ///
+ ///
+ public override void Recalculate(PointF pos, SizeF size, bool selected)
+ {
+ base.Recalculate(pos, size, selected);
+
+ title.Position = new PointF(pos.X + (size.Width * 0.5f), title.Position.Y);
+ }
+ ///
public override void Draw()
{
+ title.Draw();
}
#endregion