Skip to content
Snippets Groups Projects
Commit d30ea7e5 authored by John Mitchell's avatar John Mitchell
Browse files

Added the ability to grab the current focus.

parent 9502337f
No related branches found
No related tags found
No related merge requests found
......@@ -113,10 +113,19 @@ impl KayakRootContext {
}
}
/// Adds a kayak plugin and runs the build function on the context.
pub fn add_plugin(&mut self, plugin: impl KayakUIPlugin) {
plugin.build(self)
}
/// Retreives the current entity that has focus or None if nothing is focused.
pub fn get_current_focus(&self) -> Option<Entity> {
if let Ok(tree) = self.focus_tree.try_read() {
return tree.current().and_then(|a| Some(a.0));
}
None
}
/// Get's the layout for th given widget index.
pub(crate) fn get_layout(&self, id: &WrappedIndex) -> Option<Rect> {
if let Ok(cache) = self.layout_cache.try_read() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment