Add the option to flush keys on changing input mode on menu stack

This commit is contained in:
Steve Streeting 2024-06-27 11:46:08 +01:00
parent b601b16764
commit 7fb56434ec
2 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,11 @@ void UMenuStack::ApplyInputModeChange(EInputModeChange Change) const
ApplyInputModeChange(PreviousInputMode); ApplyInputModeChange(PreviousInputMode);
break; break;
} }
if (Change != EInputModeChange::DoNotChange && bFlushOnInputModeChange)
{
PC->FlushPressedKeys();
}
} }
void UMenuStack::ApplyMousePointerVisibility(EMousePointerVisibilityChange Change) const void UMenuStack::ApplyMousePointerVisibility(EMousePointerVisibilityChange Change) const

View File

@ -80,6 +80,10 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Behavior") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Behavior")
EInputModeChange InputModeSettingOnOpen = EInputModeChange::DoNotChange; EInputModeChange InputModeSettingOnOpen = EInputModeChange::DoNotChange;
/// When changing input mode, whether to flush pressed keys so we start fresh
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Behavior")
bool bFlushOnInputModeChange = false;
/// How this stack should set the mouse pointer visibility when it opens (default no change) /// How this stack should set the mouse pointer visibility when it opens (default no change)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Behavior") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Behavior")
EMousePointerVisibilityChange MousePointerVisibilityOnOpen = EMousePointerVisibilityChange::DoNotChange; EMousePointerVisibilityChange MousePointerVisibilityOnOpen = EMousePointerVisibilityChange::DoNotChange;