new_editor: deduplicate hosted panel command focus
This commit is contained in:
@@ -1404,31 +1404,6 @@ void ProjectPanel::ResetTransientFrames() {
|
||||
m_splitterDragging = false;
|
||||
}
|
||||
|
||||
void ProjectPanel::ClaimCommandFocus(
|
||||
const std::vector<UIInputEvent>& inputEvents,
|
||||
const UIRect& bounds,
|
||||
bool allowInteraction) {
|
||||
if (m_commandFocusService == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const UIInputEvent& event : inputEvents) {
|
||||
if (event.type == UIInputEventType::FocusGained) {
|
||||
m_commandFocusService->ClaimFocus(EditorActionRoute::Project);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!allowInteraction ||
|
||||
event.type != UIInputEventType::PointerButtonDown ||
|
||||
!ContainsPoint(bounds, event.position)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
m_commandFocusService->ClaimFocus(EditorActionRoute::Project);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPanel::Update(
|
||||
const UIEditorHostedPanelDispatchEntry& dispatchEntry,
|
||||
const std::vector<UIInputEvent>& inputEvents) {
|
||||
@@ -1489,7 +1464,9 @@ void ProjectPanel::Update(
|
||||
},
|
||||
dispatchEntry.focusGained,
|
||||
dispatchEntry.focusLost);
|
||||
ClaimCommandFocus(
|
||||
TryClaimHostedPanelCommandFocus(
|
||||
m_commandFocusService,
|
||||
EditorActionRoute::Project,
|
||||
filteredEvents,
|
||||
dispatchEntry.bounds,
|
||||
dispatchEntry.allowInteraction);
|
||||
|
||||
Reference in New Issue
Block a user