Fixed bug where a lost widget could still retain keyboard focus.

This commit is contained in:
Emil Ernerfeldt 2020-11-09 13:19:22 +01:00
parent 7cc5218630
commit 796def4bcb
2 changed files with 11 additions and 0 deletions

View file

@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
### Fixed 🐛
* Fixed bug where a lost widget could still retain keyboard focus.
## 0.3.0 - 2020-11-07
### Added ⭐

View file

@ -130,6 +130,13 @@ impl Memory {
pub(crate) fn end_frame(&mut self) {
self.areas.end_frame();
if let Some(kb_focus_id) = self.interaction.kb_focus_id {
if !self.used_ids.contains_key(&kb_focus_id) {
// Dead-mans-switch: the widget with kb focus has dissappeared!
self.interaction.kb_focus_id = None;
}
}
}
pub fn layer_id_at(&self, pos: Pos2, resize_interact_radius_side: f32) -> Option<LayerId> {