Add fixed_pos to Window (#16)
* Add fixed_pos to Window This allows changing the position of a window by opening the window with a different value. * Add docstrings for `fixed_pos`
This commit is contained in:
parent
d4cb2fa62e
commit
40af177157
2 changed files with 7 additions and 0 deletions
|
@ -90,6 +90,7 @@ impl Area {
|
|||
self
|
||||
}
|
||||
|
||||
/// Positions the window and prevents it from being moved
|
||||
pub fn fixed_pos(mut self, fixed_pos: impl Into<Pos2>) -> Self {
|
||||
let fixed_pos = fixed_pos.into();
|
||||
self.default_pos = Some(fixed_pos);
|
||||
|
|
|
@ -91,6 +91,12 @@ impl<'open> Window<'open> {
|
|||
self.default_pos(rect.min).default_size(rect.size())
|
||||
}
|
||||
|
||||
/// Positions the window and prevents it from being moved
|
||||
pub fn fixed_pos(mut self, pos: impl Into<Pos2>) -> Self {
|
||||
self.area = self.area.fixed_pos(pos);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn fixed_size(mut self, size: impl Into<Vec2>) -> Self {
|
||||
self.resize = self.resize.fixed_size(size);
|
||||
self
|
||||
|
|
Loading…
Reference in a new issue