[refactor] rename fill_color to just fill

This commit is contained in:
Emil Ernerfeldt
2020-05-23 14:17:45 +02:00
parent c7a59b57d2
commit d214574c97
16 changed files with 70 additions and 70 deletions
+2 -2
View File
@@ -86,7 +86,7 @@ impl State {
ui.add_paint_cmd(PaintCmd::Path {
path: Path::from_point_loop(&points),
closed: true,
fill_color: None,
fill: None,
outline: Some(LineStyle::new(stroke_width, stroke_color)),
});
}
@@ -230,7 +230,7 @@ impl CollapsingHeader {
where_to_put_background,
PaintCmd::Rect {
corner_radius: ui.style().interact(&interact).corner_radius,
fill_color: ui.style().interact(&interact).bg_fill_color,
fill: ui.style().interact(&interact).bg_fill,
outline: None,
rect: interact.rect,
},
+8 -8
View File
@@ -7,7 +7,7 @@ pub struct Frame {
// On each side
pub margin: Vec2,
pub corner_radius: f32,
pub fill_color: Option<Color>,
pub fill: Option<Color>,
pub outline: Option<LineStyle>,
}
@@ -16,7 +16,7 @@ impl Frame {
Self {
margin: style.window_padding,
corner_radius: style.window.corner_radius,
fill_color: Some(style.background_fill_color),
fill: Some(style.background_fill),
outline: style.interact.inactive.rect_outline, // becauce we can resize windows
}
}
@@ -25,7 +25,7 @@ impl Frame {
Self {
margin: Vec2::splat(1.0),
corner_radius: 0.0,
fill_color: None,
fill: None,
outline: Some(LineStyle::new(0.5, color::white(128))),
}
}
@@ -34,7 +34,7 @@ impl Frame {
Self {
margin: Vec2::splat(1.0),
corner_radius: 2.0,
fill_color: Some(style.background_fill_color),
fill: Some(style.background_fill),
outline: Some(LineStyle::new(1.0, color::white(128))),
}
}
@@ -43,13 +43,13 @@ impl Frame {
Self {
margin: style.window_padding,
corner_radius: 5.0,
fill_color: Some(style.background_fill_color),
fill: Some(style.background_fill),
outline: Some(LineStyle::new(1.0, color::white(128))),
}
}
pub fn fill_color(mut self, fill_color: Option<Color>) -> Self {
self.fill_color = fill_color;
pub fn fill(mut self, fill: Option<Color>) -> Self {
self.fill = fill;
self
}
@@ -109,7 +109,7 @@ impl Prepared {
where_to_put_background,
PaintCmd::Rect {
corner_radius: frame.corner_radius,
fill_color: frame.fill_color,
fill: frame.fill,
outline: frame.outline,
rect: outer_rect,
},
+7 -7
View File
@@ -25,11 +25,11 @@ pub fn bar<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> (R, Rect)
Frame::menu_bar(ui.style()).show(ui, |ui| {
let mut style = ui.style().clone();
style.button_padding = vec2(2.0, 0.0);
// style.interact.active.bg_fill_color = None;
// style.interact.active.bg_fill = None;
style.interact.active.rect_outline = None;
// style.interact.hovered.bg_fill_color = None;
// style.interact.hovered.bg_fill = None;
style.interact.hovered.rect_outline = None;
style.interact.inactive.bg_fill_color = None;
style.interact.inactive.bg_fill = None;
style.interact.inactive.rect_outline = None;
ui.set_style(style);
@@ -66,7 +66,7 @@ fn menu_impl<'c>(
let mut button = Button::new(title);
if bar_state.open_menu == Some(menu_id) {
button = button.fill_color(Some(ui.style().interact.active.fill_color));
button = button.fill(Some(ui.style().interact.active.fill));
}
let button_interact = ui.add(button);
@@ -86,11 +86,11 @@ fn menu_impl<'c>(
resize.show(ui, |ui| {
let mut style = ui.style().clone();
style.button_padding = vec2(2.0, 0.0);
// style.interact.active.bg_fill_color = None;
// style.interact.active.bg_fill = None;
style.interact.active.rect_outline = None;
// style.interact.hovered.bg_fill_color = None;
// style.interact.hovered.bg_fill = None;
style.interact.hovered.rect_outline = None;
style.interact.inactive.bg_fill_color = None;
style.interact.inactive.bg_fill = None;
style.interact.inactive.rect_outline = None;
ui.set_style(style);
ui.set_layout(Layout::justified(Direction::Vertical));
+1 -1
View File
@@ -314,7 +314,7 @@ impl Resize {
ui.add_paint_cmd(paint::PaintCmd::Rect {
rect,
corner_radius: 3.0,
fill_color: None,
fill: None,
outline: Some(ui.style().thin_outline),
});
}
+3 -3
View File
@@ -214,20 +214,20 @@ impl Prepared {
);
let style = ui.style();
let handle_fill_color = style.interact(&interact).fill_color;
let handle_fill = style.interact(&interact).fill;
let handle_outline = style.interact(&interact).rect_outline;
ui.add_paint_cmd(paint::PaintCmd::Rect {
rect: outer_scroll_rect,
corner_radius,
fill_color: Some(ui.style().dark_bg_color),
fill: Some(ui.style().dark_bg_color),
outline: None,
});
ui.add_paint_cmd(paint::PaintCmd::Rect {
rect: handle_rect.expand(-2.0),
corner_radius,
fill_color: Some(handle_fill_color),
fill: Some(handle_fill),
outline: handle_outline,
});
}
+2 -2
View File
@@ -63,7 +63,7 @@ impl<'open> Window<'open> {
self
}
/// Usage: `Winmdow::new(...).frame(|f| f.fill_color(Some(BLUE)))`
/// Usage: `Winmdow::new(...).frame(|f| f.fill(Some(BLUE)))`
/// Not sure this is a good interface for this.
pub fn frame(mut self, frame: Frame) -> Self {
self.frame = Some(frame);
@@ -505,7 +505,7 @@ fn paint_frame_interaction(
ui.add_paint_cmd(PaintCmd::Path {
path,
closed: false,
fill_color: None,
fill: None,
outline: style.rect_outline,
});
}