More work on focus, and good docs
This commit is contained in:
@@ -135,7 +135,7 @@ void AlxPlayerControllerBase::RestoreFocusToFrontWidget(const UObject *Context)
|
||||
{
|
||||
// This will trigger UpdateInputMode to shift focus back to
|
||||
// the front window, if the front window wants focus.
|
||||
FromContext(Context)->LastWidgetGrantedFocus = nullptr;
|
||||
FromContext(Context)->RootCanvas->LastWidgetGrantedFocus = nullptr;
|
||||
}
|
||||
|
||||
void AlxPlayerControllerBase::AddWidgetToRoot(UUserWidget *Widget)
|
||||
@@ -319,32 +319,22 @@ void AlxPlayerControllerBase::UpdateInputMode()
|
||||
// viewport client notifies us of that fact. We then focus the
|
||||
// widget if possible.
|
||||
//
|
||||
if ((!ShowPointer) || (LastWidgetGrantedFocus != Focus))
|
||||
if ((!ShowPointer) || (RootCanvas->LastWidgetGrantedFocus != Focus))
|
||||
{
|
||||
if (Focus)
|
||||
{
|
||||
if (TSharedPtr<SWidget> SlateFocus = Focus->GetCachedWidget())
|
||||
{
|
||||
SlateOperations.SetUserFocus(SlateFocus.ToSharedRef());
|
||||
LastWidgetGrantedFocus = Focus;
|
||||
RootCanvas->LastWidgetGrantedFocus = Focus;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SlateOperations.SetUserFocus(ViewportWidgetRef);
|
||||
LastWidgetGrantedFocus = nullptr;
|
||||
RootCanvas->LastWidgetGrantedFocus = nullptr;
|
||||
}
|
||||
}
|
||||
else if (TSharedPtr<SWidget> ClickedWidget = ClickToFocusTarget.Pin())
|
||||
{
|
||||
SlateOperations.SetUserFocus(ClickedWidget.ToSharedRef());
|
||||
}
|
||||
ClickToFocusTarget.Reset();
|
||||
}
|
||||
|
||||
void AlxPlayerControllerBase::ClickToFocus(TSharedRef<SWidget> Widget)
|
||||
{
|
||||
ClickToFocusTarget = Widget.ToWeakPtr();
|
||||
}
|
||||
|
||||
void AlxPlayerControllerBase::UpdateLookAt()
|
||||
|
||||
Reference in New Issue
Block a user