Expose getter for currently focused widget.
This commit is contained in:
parent
de02f7d042
commit
0fd88e52da
1 changed files with 5 additions and 0 deletions
|
@ -314,6 +314,11 @@ impl Memory {
|
||||||
self.interaction.focus.id == Some(id)
|
self.interaction.focus.id == Some(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Which widget has keyboard focus?
|
||||||
|
pub fn focus(&self) -> Option<Id> {
|
||||||
|
self.interaction.focus.id
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn lock_focus(&mut self, id: Id, lock_focus: bool) {
|
pub(crate) fn lock_focus(&mut self, id: Id, lock_focus: bool) {
|
||||||
if self.had_focus_last_frame(id) && self.has_focus(id) {
|
if self.had_focus_last_frame(id) && self.has_focus(id) {
|
||||||
self.interaction.focus.is_focus_locked = lock_focus;
|
self.interaction.focus.is_focus_locked = lock_focus;
|
||||||
|
|
Loading…
Reference in a new issue