mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
Prevent Unfocus if the widget is not focused by the current user
This commit is contained in:
parent
75f38faa81
commit
6af2ba2766
@ -129,8 +129,15 @@ void UFocusableButton::Unfocus() const
|
|||||||
TOptional<int32> UserIndex = FSlateApplication::Get().GetUserIndexForController(
|
TOptional<int32> UserIndex = FSlateApplication::Get().GetUserIndexForController(
|
||||||
LocalPlayer->GetControllerId());
|
LocalPlayer->GetControllerId());
|
||||||
if (UserIndex.IsSet())
|
if (UserIndex.IsSet())
|
||||||
|
{
|
||||||
|
TSharedPtr<SWidget> SafeWidget = GetCachedWidget();
|
||||||
|
if (SafeWidget.IsValid())
|
||||||
|
{
|
||||||
|
if (SafeWidget->HasUserFocus(UserIndex.GetValue()))
|
||||||
{
|
{
|
||||||
FSlateApplication::Get().ClearUserFocus(UserIndex.GetValue());
|
FSlateApplication::Get().ClearUserFocus(UserIndex.GetValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -115,8 +115,15 @@ void UFocusableCheckBox::Unfocus() const
|
|||||||
TOptional<int32> UserIndex = FSlateApplication::Get().GetUserIndexForController(
|
TOptional<int32> UserIndex = FSlateApplication::Get().GetUserIndexForController(
|
||||||
LocalPlayer->GetControllerId());
|
LocalPlayer->GetControllerId());
|
||||||
if (UserIndex.IsSet())
|
if (UserIndex.IsSet())
|
||||||
|
{
|
||||||
|
TSharedPtr<SWidget> SafeWidget = GetCachedWidget();
|
||||||
|
if (SafeWidget.IsValid())
|
||||||
|
{
|
||||||
|
if (SafeWidget->HasUserFocus(UserIndex.GetValue()))
|
||||||
{
|
{
|
||||||
FSlateApplication::Get().ClearUserFocus(UserIndex.GetValue());
|
FSlateApplication::Get().ClearUserFocus(UserIndex.GetValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user