anvil.window_map: add WindowMap::location

This commit is contained in:
Ivan Molodetskikh 2020-02-01 18:30:01 +03:00
parent 69b1c1870e
commit a51e421c19
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
1 changed files with 8 additions and 0 deletions

View File

@ -234,4 +234,12 @@ where
pub fn clear(&mut self) {
self.windows.clear();
}
/// Returns the location of the toplevel, if it exists.
pub fn location(&self, toplevel: &Kind<R>) -> Option<(i32, i32)> {
self.windows
.iter()
.find(|w| w.toplevel.equals(toplevel))
.map(|w| w.location)
}
}