Make Memory::lock_focus public
closes https://github.com/emilk/egui/issues/993
This commit is contained in:
parent
c63996179b
commit
2684929a5d
1 changed files with 5 additions and 2 deletions
|
@ -327,13 +327,16 @@ impl Memory {
|
|||
self.interaction.focus.id
|
||||
}
|
||||
|
||||
pub(crate) fn lock_focus(&mut self, id: Id, lock_focus: bool) {
|
||||
/// Prevent keyboard focus from moving away from this widget even if users presses the tab key.
|
||||
/// You must first give focus to the widget before calling this.
|
||||
pub fn lock_focus(&mut self, id: Id, lock_focus: bool) {
|
||||
if self.had_focus_last_frame(id) && self.has_focus(id) {
|
||||
self.interaction.focus.is_focus_locked = lock_focus;
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn has_lock_focus(&mut self, id: Id) -> bool {
|
||||
/// Is the keyboard focus locked on this widget? If so the focus won't move even if the user presses the tab key.
|
||||
pub fn has_lock_focus(&mut self, id: Id) -> bool {
|
||||
if self.had_focus_last_frame(id) && self.has_focus(id) {
|
||||
self.interaction.focus.is_focus_locked
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue