Replace usages of is_parent_view_focused with is_self_focused

Previously, this was used because we didn't have access to the current
view and `EventContext` was an element-only abstraction. Now that the
`EventContext` wraps the current view's `ViewContext` we can simply check
for the view's focus and avoid querying ancestors.
This commit is contained in:
Antonio Scandurra 2023-05-05 10:08:22 +02:00
parent 80ad59a620
commit b9ed327b94
2 changed files with 2 additions and 10 deletions

View file

@ -2859,14 +2859,6 @@ impl<'a, 'b, V: View> ViewContext<'a, 'b, V> {
self.window.focused_view_id == Some(self.view_id)
}
pub fn is_parent_view_focused(&self) -> bool {
if let Some(parent_view_id) = self.ancestors(self.view_id).next().clone() {
self.focused_view_id() == Some(parent_view_id)
} else {
false
}
}
pub fn focus_parent(&mut self) {
let window_id = self.window_id;
let view_id = self.view_id;