@@ -1961,7 +1961,7 @@ impl Window {
}
/// Determine whether the given action is available along the dispatch path to the currently focused element.
- pub fn is_action_available(&self, action: &dyn Action, cx: &mut App) -> bool {
+ pub fn is_action_available(&self, action: &dyn Action, cx: &App) -> bool {
let node_id =
self.focus_node_id_in_rendered_frame(self.focused(cx).map(|handle| handle.id));
self.rendered_frame
@@ -1969,6 +1969,14 @@ impl Window {
.is_action_available(action, node_id)
}
+ /// Determine whether the given action is available along the dispatch path to the given focus_handle.
+ pub fn is_action_available_in(&self, action: &dyn Action, focus_handle: &FocusHandle) -> bool {
+ let node_id = self.focus_node_id_in_rendered_frame(Some(focus_handle.id));
+ self.rendered_frame
+ .dispatch_tree
+ .is_action_available(action, node_id)
+ }
+
/// The position of the mouse relative to the window.
pub fn mouse_position(&self) -> Point<Pixels> {
self.mouse_position