mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
[resize] improve default/min sizes of some resize areas
This commit is contained in:
@@ -25,6 +25,7 @@ pub struct Resize {
|
|||||||
/// If false, we are no enabled
|
/// If false, we are no enabled
|
||||||
resizable: bool,
|
resizable: bool,
|
||||||
|
|
||||||
|
// TODO: do we really need both?
|
||||||
min_content_size: Vec2,
|
min_content_size: Vec2,
|
||||||
min_desired_size: Vec2,
|
min_desired_size: Vec2,
|
||||||
|
|
||||||
@@ -40,8 +41,8 @@ impl Default for Resize {
|
|||||||
id: None,
|
id: None,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
min_content_size: Vec2::splat(16.0),
|
min_content_size: Vec2::splat(16.0),
|
||||||
min_desired_size: vec2(200.0, 400.0),
|
min_desired_size: vec2(64.0, 64.0), // TODO: min size of a a resizable area (e.g. a window or a text edit)
|
||||||
default_size: vec2(280.0, 400.0), // TODO: perferred size for a resizable area (e.g. a window)
|
default_size: vec2(128.0, 128.0), // TODO: perferred size for a resizable area (e.g. a window or a text edit)
|
||||||
outline: true,
|
outline: true,
|
||||||
handle_offset: Default::default(),
|
handle_offset: Default::default(),
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,8 @@ impl Resize {
|
|||||||
|
|
||||||
/// Not manually resizable, just takes the size of its contents.
|
/// Not manually resizable, just takes the size of its contents.
|
||||||
pub fn auto_sized(self) -> Self {
|
pub fn auto_sized(self) -> Self {
|
||||||
self.default_size(Vec2::splat(f32::INFINITY))
|
self.min_desired_size(Vec2::zero())
|
||||||
|
.default_size(Vec2::splat(f32::INFINITY))
|
||||||
.resizable(false)
|
.resizable(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ impl<'open> Window<'open> {
|
|||||||
resize: Resize::default()
|
resize: Resize::default()
|
||||||
.outline(false)
|
.outline(false)
|
||||||
.min_content_size([96.0, 32.0])
|
.min_content_size([96.0, 32.0])
|
||||||
.min_desired_size([96.0, 200.0]),
|
.min_desired_size([96.0, 32.0])
|
||||||
|
.default_size([280.0, 400.0]),
|
||||||
scroll: Some(
|
scroll: Some(
|
||||||
ScrollArea::default()
|
ScrollArea::default()
|
||||||
.always_show_scroll(false)
|
.always_show_scroll(false)
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ impl ExampleWindow {
|
|||||||
CollapsingHeader::new("Resize")
|
CollapsingHeader::new("Resize")
|
||||||
.default_open(false)
|
.default_open(false)
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
Resize::default().default_height(200.0).show(ui, |ui| {
|
Resize::default().default_height(100.0).show(ui, |ui| {
|
||||||
ui.add(label!("This ui can be resized!"));
|
ui.add(label!("This ui can be resized!"));
|
||||||
ui.add(label!("Just pull the handle on the bottom right"));
|
ui.add(label!("Just pull the handle on the bottom right"));
|
||||||
});
|
});
|
||||||
@@ -424,7 +424,7 @@ impl Painting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Resize::default()
|
Resize::default()
|
||||||
.default_height(200.0)
|
.default_size([200.0, 200.0])
|
||||||
.show(ui, |ui| self.content(ui));
|
.show(ui, |ui| self.content(ui));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ impl Default for LayoutExample {
|
|||||||
impl LayoutExample {
|
impl LayoutExample {
|
||||||
pub fn ui(&mut self, ui: &mut Ui) {
|
pub fn ui(&mut self, ui: &mut Ui) {
|
||||||
Resize::default()
|
Resize::default()
|
||||||
.default_size([200.0, 200.0])
|
.default_size([200.0, 100.0])
|
||||||
.show(ui, |ui| self.content_ui(ui));
|
.show(ui, |ui| self.content_ui(ui));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user