diff --git a/src/Myra/Graphics2D/UI/Containers/SplitPane.cs b/src/Myra/Graphics2D/UI/Containers/SplitPane.cs index 41d9c2b7..eb14f0fc 100644 --- a/src/Myra/Graphics2D/UI/Containers/SplitPane.cs +++ b/src/Myra/Graphics2D/UI/Containers/SplitPane.cs @@ -131,6 +131,9 @@ private void HandleOnPressedChanged(object sender, EventArgs args) { _handleDown = null; _mouseCoord = null; + + MyraEnvironment.SetMouseCursorFromWidget = true; + MyraEnvironment.MouseCursorType = MouseCursor ?? MyraEnvironment.DefaultMouseCursorType; } else if (Desktop != null) { @@ -140,6 +143,16 @@ private void HandleOnPressedChanged(object sender, EventArgs args) _mouseCoord = Orientation == Orientation.Horizontal ? Desktop.TouchPosition.Value.X - handleGlobalPos.X : Desktop.TouchPosition.Value.Y - handleGlobalPos.Y; + + MyraEnvironment.SetMouseCursorFromWidget = false; + if (Orientation == Orientation.Horizontal) + { + MyraEnvironment.MouseCursorType = MouseCursorType.SizeWE; + } + else + { + MyraEnvironment.MouseCursorType = MouseCursorType.SizeNS; + } } } @@ -218,10 +231,12 @@ public void Reset() if (Orientation == Orientation.Horizontal) { + handle.MouseCursor = MouseCursorType.SizeWE; handle.VerticalAlignment = VerticalAlignment.Stretch; } else { + handle.MouseCursor = MouseCursorType.SizeNS; handle.HorizontalAlignment = HorizontalAlignment.Stretch; } diff --git a/src/Myra/Graphics2D/UI/Widget.Input.cs b/src/Myra/Graphics2D/UI/Widget.Input.cs index 480b8a5c..d80b1ce3 100644 --- a/src/Myra/Graphics2D/UI/Widget.Input.cs +++ b/src/Myra/Graphics2D/UI/Widget.Input.cs @@ -287,7 +287,8 @@ void IInputEventsProcessor.ProcessEvent(InputEventType eventType) } _lastMouseMovement = null; - if (MouseCursor != null) + + if (MyraEnvironment.SetMouseCursorFromWidget && MouseCursor != null) { MyraEnvironment.MouseCursorType = MyraEnvironment.DefaultMouseCursorType; } @@ -297,7 +298,7 @@ void IInputEventsProcessor.ProcessEvent(InputEventType eventType) break; case InputEventType.MouseEntered: _lastMouseMovement = DateTime.Now; - if (MouseCursor != null) + if (MyraEnvironment.SetMouseCursorFromWidget && MouseCursor != null) { MyraEnvironment.MouseCursorType = MouseCursor.Value; } @@ -307,7 +308,6 @@ void IInputEventsProcessor.ProcessEvent(InputEventType eventType) break; case InputEventType.MouseMoved: _lastMouseMovement = DateTime.Now; - OnMouseMoved(); MouseMoved.Invoke(this); break; diff --git a/src/Myra/MyraEnvironment.cs b/src/Myra/MyraEnvironment.cs index dba5ef5f..e8e5ffce 100644 --- a/src/Myra/MyraEnvironment.cs +++ b/src/Myra/MyraEnvironment.cs @@ -83,6 +83,8 @@ private static IntPtr GetSystemCursor(SDL_SystemCursor type) private static MouseCursorType _mouseCursorType; private static AssetManager _defaultAssetManager; + public static bool SetMouseCursorFromWidget { get; set; } = true; + public static MouseCursorType MouseCursorType { get => _mouseCursorType;