Use consistent order of width/color arguments for line style

This commit is contained in:
Emil Ernerfeldt 2020-08-29 14:45:20 +02:00
parent b3b4fbc016
commit 7b75bd2d09
6 changed files with 8 additions and 8 deletions

View file

@ -715,13 +715,13 @@ fn close_button(ui: &mut Ui, rect: Rect) -> InteractInfo {
let stroke_width = ui.style().interact(&interact).stroke_width; let stroke_width = ui.style().interact(&interact).stroke_width;
ui.painter().add(PaintCmd::line_segment( ui.painter().add(PaintCmd::line_segment(
[rect.left_top(), rect.right_bottom()], [rect.left_top(), rect.right_bottom()],
stroke_color,
stroke_width, stroke_width,
stroke_color,
)); ));
ui.painter().add(PaintCmd::line_segment( ui.painter().add(PaintCmd::line_segment(
[rect.right_top(), rect.left_bottom()], [rect.right_top(), rect.left_bottom()],
stroke_color,
stroke_width, stroke_width,
stroke_color,
)); ));
interact interact
} }

View file

@ -134,7 +134,7 @@ impl FractalClock {
rect.center() + scale * points[1].to_vec2(), rect.center() + scale * points[1].to_vec2(),
]; ];
painter.add(PaintCmd::line_segment([line[0], line[1]], color, width)); painter.add(PaintCmd::line_segment([line[0], line[1]], width, color));
}; };
let hand_rotations = [ let hand_rotations = [

View file

@ -42,7 +42,7 @@ pub enum PaintCmd {
} }
impl PaintCmd { impl PaintCmd {
pub fn line_segment(points: [Pos2; 2], color: Color, width: f32) -> Self { pub fn line_segment(points: [Pos2; 2], width: f32, color: Color) -> Self {
Self::LineSegment { Self::LineSegment {
points, points,
style: LineStyle::new(width, color), style: LineStyle::new(width, color),

View file

@ -403,7 +403,7 @@ impl Ui {
let paint_line_seg = |a, b| { let paint_line_seg = |a, b| {
self.painter self.painter
.add(PaintCmd::line_segment([a, b], color, width)) .add(PaintCmd::line_segment([a, b], width, color))
}; };
if too_wide { if too_wide {
@ -567,8 +567,8 @@ impl Ui {
let line_end = pos2(line_start.x, line_start.y + size.y - 2.0); let line_end = pos2(line_start.x, line_start.y + size.y - 2.0);
self.painter.add(PaintCmd::line_segment( self.painter.add(PaintCmd::line_segment(
[line_start, line_end], [line_start, line_end],
gray(150, 255),
self.style.line_width, self.style.line_width,
gray(150, 255),
)); ));
(ret, self.allocate_space(indent + size)) (ret, self.allocate_space(indent + size))

View file

@ -201,8 +201,8 @@ impl Widget for Hyperlink {
let max_x = pos.x + line.max_x(); let max_x = pos.x + line.max_x();
ui.painter().add(PaintCmd::line_segment( ui.painter().add(PaintCmd::line_segment(
[pos2(min_x, y), pos2(max_x, y)], [pos2(min_x, y), pos2(max_x, y)],
color,
ui.style().line_width, ui.style().line_width,
color,
)); ));
} }
} }

View file

@ -202,8 +202,8 @@ impl<'t> Widget for TextEdit<'t> {
let cursor_pos = interact.rect.min + galley.char_start_pos(cursor); let cursor_pos = interact.rect.min + galley.char_start_pos(cursor);
painter.add(PaintCmd::line_segment( painter.add(PaintCmd::line_segment(
[cursor_pos, cursor_pos + vec2(0.0, line_spacing)], [cursor_pos, cursor_pos + vec2(0.0, line_spacing)],
color::WHITE,
ui.style().text_cursor_width, ui.style().text_cursor_width,
color::WHITE,
)); ));
} }
} }