Skip to content
Snippets Groups Projects
Commit 3f5770f4 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Fixing some input handling

parent 42dffd0f
No related branches found
No related tags found
No related merge requests found
...@@ -38,13 +38,13 @@ FReply SDasherWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPoin ...@@ -38,13 +38,13 @@ FReply SDasherWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPoin
FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex()); FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex());
if(MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) if(MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && !MouseState.PrimaryButtonPressed)
{ {
DasherMainInterface->KeyDown(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input); DasherMainInterface->KeyDown(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input);
MouseState.PrimaryButtonPressed = true; MouseState.PrimaryButtonPressed = true;
MouseListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), MouseState.PrimaryButtonPressed); MouseListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), MouseState.PrimaryButtonPressed);
} }
else if(MouseEvent.GetEffectingButton() == EKeys::RightMouseButton) else if(MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && !MouseState.SecondaryButtonPressed)
{ {
DasherMainInterface->KeyDown(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Secondary_Input); DasherMainInterface->KeyDown(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Secondary_Input);
MouseState.SecondaryButtonPressed = true; MouseState.SecondaryButtonPressed = true;
...@@ -127,9 +127,10 @@ void SDasherWidget::OnMouseLeave(const FPointerEvent& MouseEvent) ...@@ -127,9 +127,10 @@ void SDasherWidget::OnMouseLeave(const FPointerEvent& MouseEvent)
{ {
SWidget::OnMouseLeave(MouseEvent); SWidget::OnMouseLeave(MouseEvent);
if (InputPaused) return;
FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex()); FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex());
MouseState.CurrentlyHovering = false;
if (InputPaused) return;
if(MouseState.PrimaryButtonPressed) if(MouseState.PrimaryButtonPressed)
{ {
...@@ -144,8 +145,6 @@ void SDasherWidget::OnMouseLeave(const FPointerEvent& MouseEvent) ...@@ -144,8 +145,6 @@ void SDasherWidget::OnMouseLeave(const FPointerEvent& MouseEvent)
BoostListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), false); BoostListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), false);
MouseState.DisabledDueToMouseLeave = true; MouseState.DisabledDueToMouseLeave = true;
} }
MouseState.CurrentlyHovering = false;
} }
FReply SDasherWidget::OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) FReply SDasherWidget::OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent)
...@@ -157,13 +156,13 @@ FReply SDasherWidget::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointe ...@@ -157,13 +156,13 @@ FReply SDasherWidget::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointe
{ {
FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex()); FMouseState& MouseState = GetMouseState(MouseEvent.GetPointerIndex());
if(MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) if(MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && MouseState.PrimaryButtonPressed)
{ {
DasherMainInterface->KeyUp(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input); DasherMainInterface->KeyUp(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input);
MouseState.PrimaryButtonPressed = false; MouseState.PrimaryButtonPressed = false;
MouseListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), MouseState.PrimaryButtonPressed); MouseListeners.ExecuteIfBound(MouseEvent.GetPointerIndex(), MouseState.PrimaryButtonPressed);
} }
else if(MouseEvent.GetEffectingButton() == EKeys::RightMouseButton) else if(MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && MouseState.SecondaryButtonPressed)
{ {
DasherMainInterface->KeyUp(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Secondary_Input); DasherMainInterface->KeyUp(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Secondary_Input);
MouseState.SecondaryButtonPressed = false; MouseState.SecondaryButtonPressed = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment