Implement MouseWheel input.

This commit is contained in:
Pieter-Jan Briers
2019-02-21 02:03:25 +01:00
parent 0b0a5d4887
commit 7ef499c1da
3 changed files with 23 additions and 0 deletions

View File

@@ -89,6 +89,11 @@ namespace SS14.Client
/// </summary>
public void MouseWheel(MouseWheelEventArgs mouseWheelEventArgs)
{
_userInterfaceManager.MouseWheel(mouseWheelEventArgs);
if (mouseWheelEventArgs.Handled)
{
return;
}
_stateManager.MouseWheelMove(mouseWheelEventArgs);
}
}

View File

@@ -82,6 +82,8 @@ namespace SS14.Client.Interfaces.UserInterface
void MouseMove(MouseMoveEventArgs mouseMoveEventArgs);
void MouseWheel(MouseWheelEventArgs args);
void TextEntered(TextEventArgs textEvent);
void KeyDown(KeyEventArgs keyEvent);

View File

@@ -213,6 +213,22 @@ namespace SS14.Client.UserInterface
}
}
public void MouseWheel(MouseWheelEventArgs args)
{
var control = MouseGetControl(args.Position);
if (control == null)
{
return;
}
args.Handle();
var guiArgs = new GUIMouseWheelEventArgs(args.WheelDirection, control, Mouse.ButtonMask.None, args.Position,
args.Position - control.GlobalPosition, args.Alt, args.Control, args.Shift, args.System);
_doMouseGuiInput(control, guiArgs, (c, ev) => c.MouseWheel(ev));
}
public void TextEntered(TextEventArgs textEvent)
{
if (KeyboardFocused == null)