[style] rounded buttons and tweak some spacing and sizes
This commit is contained in:
parent
c35494e4ec
commit
5bf8051be5
5 changed files with 24 additions and 8 deletions
|
@ -245,7 +245,7 @@ fn automatic_area_position(ctx: &Context) -> Pos2 {
|
|||
|
||||
let left = 16.0;
|
||||
let top = 32.0; // allow existence of menu bar. TODO: get from ui.available()
|
||||
let spacing = 32.0;
|
||||
let spacing = 16.0;
|
||||
|
||||
if existing.is_empty() {
|
||||
return pos2(left, top);
|
||||
|
|
|
@ -42,7 +42,7 @@ impl Default for Resize {
|
|||
resizable: true,
|
||||
min_size: Vec2::splat(16.0),
|
||||
max_size: Vec2::infinity(),
|
||||
default_size: vec2(200.0, 400.0), // TODO: default height for a resizable area (e.g. a window)
|
||||
default_size: vec2(280.0, 400.0), // TODO: perferred size for a resizable area (e.g. a window)
|
||||
outline: true,
|
||||
handle_offset: Default::default(),
|
||||
}
|
||||
|
@ -56,11 +56,24 @@ impl Resize {
|
|||
self
|
||||
}
|
||||
|
||||
/// Preferred / suggested width. Actual width will depend on contents.
|
||||
///
|
||||
/// Examples:
|
||||
/// * if the contents is text, this will decide where we break long lines.
|
||||
/// * if the contents is a canvas, this decides the width of it,
|
||||
/// * if the contents is some buttons, this is ignored and we will auto-size.
|
||||
pub fn default_width(mut self, width: f32) -> Self {
|
||||
self.default_size.x = width;
|
||||
self
|
||||
}
|
||||
|
||||
/// Preferred / suggested height. Actual height will depend on contents.
|
||||
///
|
||||
/// Examples:
|
||||
/// * if the contents is a `ScrollArea` then this decides the maximum size.
|
||||
/// * if the contents is a canvas, this decides the height of it,
|
||||
/// * if the contents is text and buttons, then the `default_height` is ignored
|
||||
/// and the height is picked automatically..
|
||||
pub fn default_height(mut self, height: f32) -> Self {
|
||||
self.default_size.y = height;
|
||||
self
|
||||
|
|
|
@ -76,7 +76,7 @@ impl ScrollArea {
|
|||
// outer: size of scroll area including scroll bar(s)
|
||||
// inner: excluding scroll bar(s). The area we clip the contents to.
|
||||
|
||||
let max_scroll_bar_width = 16.0;
|
||||
let max_scroll_bar_width = ui.style().item_spacing.x + 16.0;
|
||||
|
||||
let current_scroll_bar_width = if state.show_scroll || !auto_hide_scroll {
|
||||
max_scroll_bar_width // TODO: animate?
|
||||
|
@ -161,7 +161,8 @@ impl Prepared {
|
|||
|
||||
let show_scroll_this_frame = content_is_too_small || always_show_scroll;
|
||||
if show_scroll_this_frame || state.show_scroll {
|
||||
let left = inner_rect.right() + 2.0;
|
||||
let margin = ui.style().item_spacing.x; // margin between contents and scroll bar
|
||||
let left = inner_rect.right() + margin;
|
||||
let right = outer_rect.right();
|
||||
let corner_radius = (right - left) / 2.0;
|
||||
let top = inner_rect.top();
|
||||
|
|
|
@ -287,7 +287,9 @@ impl Path {
|
|||
/// quadrant 3 right top
|
||||
/// 4 * TAU / 4 = right
|
||||
pub fn add_circle_quadrant(&mut self, center: Pos2, radius: f32, quadrant: f32) {
|
||||
let n = (radius * 0.5).round() as i32; // TODO: tweak a bit more
|
||||
// TODO: optimize with precalculated vertices for some radii ranges
|
||||
|
||||
let n = (radius * 0.75).round() as i32; // TODO: tweak a bit more
|
||||
let n = clamp(n, 2..=32);
|
||||
self.reserve(n as usize + 1);
|
||||
const RIGHT_ANGLE: f32 = TAU / 4.0;
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Default for Interact {
|
|||
stroke_color: WHITE,
|
||||
stroke_width: 2.0,
|
||||
rect_outline: Some(LineStyle::new(2.0, WHITE)),
|
||||
corner_radius: 5.0,
|
||||
corner_radius: 0.0,
|
||||
},
|
||||
hovered: WidgetStyle {
|
||||
bg_fill: None,
|
||||
|
@ -113,7 +113,7 @@ impl Default for Interact {
|
|||
stroke_color: gray(240, 255),
|
||||
stroke_width: 1.5,
|
||||
rect_outline: Some(LineStyle::new(1.0, WHITE)),
|
||||
corner_radius: 5.0,
|
||||
corner_radius: 2.0,
|
||||
},
|
||||
inactive: WidgetStyle {
|
||||
bg_fill: None,
|
||||
|
@ -121,7 +121,7 @@ impl Default for Interact {
|
|||
stroke_color: gray(210, 255), // Mustn't look grayed out!
|
||||
stroke_width: 1.0,
|
||||
rect_outline: Some(LineStyle::new(1.0, white(128))),
|
||||
corner_radius: 0.0,
|
||||
corner_radius: 4.0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue