diff --git a/Source/Engine/UI/GUI/Common/Slider.cs b/Source/Engine/UI/GUI/Common/Slider.cs
index 8c7b022fe..f1f33732e 100644
--- a/Source/Engine/UI/GUI/Common/Slider.cs
+++ b/Source/Engine/UI/GUI/Common/Slider.cs
@@ -1,6 +1,7 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
+using System.Collections.Generic;
namespace FlaxEngine.GUI;
@@ -408,6 +409,40 @@ public class Slider : ContainerControl
base.OnLostFocus();
}
+ ///
+ public override Control OnNavigate(NavDirection direction, Float2 location, Control caller, List visited)
+ {
+ bool _isHorizontal = Direction is SliderDirection.HorizontalRight or SliderDirection.HorizontalLeft;
+
+ float keyOrGamepadPosition = _isHorizontal ? location.X : location.Y;
+
+ if (_thumbRect.Contains(ref location))
+ {
+ // Start sliding
+ _isSliding = true;
+ SlidingStart?.Invoke();
+ return this;
+ }
+ else
+ {
+ Value += (keyOrGamepadPosition < _thumbCenter ? -1 : 1) * 10;
+ }
+
+ return base.OnNavigate(direction, location, caller, visited);
+ }
+
+ ///
+ public override bool OnKeyDown(KeyboardKeys key)
+ {
+ if (key == KeyboardKeys.Escape)
+ {
+ Defocus();
+ return true;
+ }
+
+ return base.OnKeyDown(key);
+ }
+
///
public override bool OnMouseDown(Float2 location, MouseButton button)
{
@@ -443,6 +478,21 @@ public class Slider : ContainerControl
return base.OnMouseDown(location, button);
}
+ ///
+ public override bool OnTouchDown(Float2 location, int pointerId)
+ {
+ if (base.OnTouchDown(location, pointerId))
+ return true;
+
+ if (!new Rectangle(Float2.Zero, Size).Contains(ref location))
+ {
+ Defocus();
+ return true;
+ }
+
+ return false;
+ }
+
///
public override void OnMouseMove(Float2 location)
{