mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
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:
@@ -90,6 +90,7 @@ impl Area {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Positions the window and prevents it from being moved
|
||||||
pub fn fixed_pos(mut self, fixed_pos: impl Into<Pos2>) -> Self {
|
pub fn fixed_pos(mut self, fixed_pos: impl Into<Pos2>) -> Self {
|
||||||
let fixed_pos = fixed_pos.into();
|
let fixed_pos = fixed_pos.into();
|
||||||
self.default_pos = Some(fixed_pos);
|
self.default_pos = Some(fixed_pos);
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ impl<'open> Window<'open> {
|
|||||||
self.default_pos(rect.min).default_size(rect.size())
|
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 {
|
pub fn fixed_size(mut self, size: impl Into<Vec2>) -> Self {
|
||||||
self.resize = self.resize.fixed_size(size);
|
self.resize = self.resize.fixed_size(size);
|
||||||
self
|
self
|
||||||
|
|||||||
Reference in New Issue
Block a user