mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 00:10:32 +00:00
Updated input handler to ignore fake mouse events potentially raised when touch input is unhandled.
This commit is contained in:
parent
71dd082f69
commit
95d27334fe
@ -117,6 +117,11 @@ FReply UImGuiInputHandler::OnAnalogValueChanged(const FAnalogInputEvent& AnalogI
|
||||
|
||||
FReply UImGuiInputHandler::OnMouseButtonDown(const FPointerEvent& MouseEvent)
|
||||
{
|
||||
if (MouseEvent.IsTouchEvent())
|
||||
{
|
||||
return ToReply(false);
|
||||
}
|
||||
|
||||
InputState->SetMouseDown(MouseEvent, true);
|
||||
return ToReply(true);
|
||||
}
|
||||
@ -129,6 +134,11 @@ FReply UImGuiInputHandler::OnMouseButtonDoubleClick(const FPointerEvent& MouseEv
|
||||
|
||||
FReply UImGuiInputHandler::OnMouseButtonUp(const FPointerEvent& MouseEvent)
|
||||
{
|
||||
if (MouseEvent.IsTouchEvent())
|
||||
{
|
||||
return ToReply(false);
|
||||
}
|
||||
|
||||
InputState->SetMouseDown(MouseEvent, false);
|
||||
return ToReply(true);
|
||||
}
|
||||
@ -139,6 +149,16 @@ FReply UImGuiInputHandler::OnMouseWheel(const FPointerEvent& MouseEvent)
|
||||
return ToReply(true);
|
||||
}
|
||||
|
||||
FReply UImGuiInputHandler::OnMouseMove(const FVector2D& MousePosition, const FPointerEvent& MouseEvent)
|
||||
{
|
||||
if (MouseEvent.IsTouchEvent())
|
||||
{
|
||||
return ToReply(false);
|
||||
}
|
||||
|
||||
return OnMouseMove(MousePosition);
|
||||
}
|
||||
|
||||
FReply UImGuiInputHandler::OnMouseMove(const FVector2D& MousePosition)
|
||||
{
|
||||
InputState->SetMousePosition(MousePosition);
|
||||
|
@ -189,7 +189,7 @@ FReply SImGuiWidget::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEve
|
||||
|
||||
FReply SImGuiWidget::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||||
{
|
||||
return InputHandler->OnMouseMove(TransformScreenPointToImGui(MyGeometry, MouseEvent.GetScreenSpacePosition()));
|
||||
return InputHandler->OnMouseMove(TransformScreenPointToImGui(MyGeometry, MouseEvent.GetScreenSpacePosition()), MouseEvent);
|
||||
}
|
||||
|
||||
FReply SImGuiWidget::OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& FocusEvent)
|
||||
|
@ -83,8 +83,10 @@ public:
|
||||
/**
|
||||
* Called to handle mouse move events.
|
||||
* @param MousePosition Mouse position (in ImGui space)
|
||||
* @param MouseEvent Optional mouse event passed from Slate
|
||||
* @returns Response whether the event was handled
|
||||
*/
|
||||
virtual FReply OnMouseMove(const FVector2D& MousePosition, const FPointerEvent& MouseEvent);
|
||||
virtual FReply OnMouseMove(const FVector2D& MousePosition);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user