mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 15:13:12 -04:00
A Window can now be resizable in only one direction (#4155)
For instance: `Window::new(…).resizable([true, false])` is a window that is only resizable in the horizontal direction. This PR also removes a hack added in https://github.com/emilk/egui/pull/3039 which is no longer needed since https://github.com/emilk/egui/pull/4026
This commit is contained in:
@@ -19,6 +19,30 @@ impl Vec2b {
|
||||
pub fn any(&self) -> bool {
|
||||
self.x || self.y
|
||||
}
|
||||
|
||||
/// Are both `x` and `y` true?
|
||||
#[inline]
|
||||
pub fn all(&self) -> bool {
|
||||
self.x && self.y
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn and(&self, other: impl Into<Self>) -> Self {
|
||||
let other = other.into();
|
||||
Self {
|
||||
x: self.x && other.x,
|
||||
y: self.y && other.y,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn or(&self, other: impl Into<Self>) -> Self {
|
||||
let other = other.into();
|
||||
Self {
|
||||
x: self.x || other.x,
|
||||
y: self.y || other.y,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for Vec2b {
|
||||
|
||||
Reference in New Issue
Block a user