mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Add a fractal clock example to showcase painting performance
This commit is contained in:
@@ -37,6 +37,16 @@ impl Frame {
|
||||
outline: Some(Outline::new(1.0, color::white(128))),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_color(mut self, fill_color: Option<Color>) -> Self {
|
||||
self.fill_color = fill_color;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn outline(mut self, outline: Option<Outline>) -> Self {
|
||||
self.outline = outline;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Frame {
|
||||
|
||||
@@ -48,20 +48,27 @@ impl<'open> Window<'open> {
|
||||
self
|
||||
}
|
||||
|
||||
/// This is quite a crap idea
|
||||
/// Usage: `Winmdow::new(...).mutate(|w| w.resize = w.resize.auto_expand_width(true))`
|
||||
/// Not sure this is a good interface for this.
|
||||
pub fn mutate(mut self, mutate: impl Fn(&mut Self)) -> Self {
|
||||
mutate(&mut self);
|
||||
self
|
||||
}
|
||||
|
||||
/// This is quite a crap idea
|
||||
/// Usage: `Winmdow::new(...).resize(|r| r.auto_expand_width(true))`
|
||||
/// Not sure this is a good interface for this.
|
||||
pub fn resize(mut self, mutate: impl Fn(Resize) -> Resize) -> Self {
|
||||
self.resize = mutate(self.resize);
|
||||
self
|
||||
}
|
||||
|
||||
/// Usage: `Winmdow::new(...).frame(|f| f.fill_color(Some(BLUE)))`
|
||||
/// Not sure this is a good interface for this.
|
||||
pub fn frame(mut self, frame: Frame) -> Self {
|
||||
self.frame = Some(frame);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn default_pos(mut self, default_pos: Pos2) -> Self {
|
||||
self.area = self.area.default_pos(default_pos);
|
||||
self
|
||||
@@ -72,6 +79,10 @@ impl<'open> Window<'open> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn default_rect(self, rect: Rect) -> Self {
|
||||
self.default_pos(rect.min).default_size(rect.size())
|
||||
}
|
||||
|
||||
pub fn min_size(mut self, min_size: Vec2) -> Self {
|
||||
self.resize = self.resize.min_size(min_size);
|
||||
self
|
||||
@@ -100,6 +111,13 @@ impl<'open> Window<'open> {
|
||||
self.scroll = None;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn scroll(mut self, scroll: bool) -> Self {
|
||||
if !scroll {
|
||||
self.scroll = None;
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'open> Window<'open> {
|
||||
|
||||
Reference in New Issue
Block a user