Browse Source

Use consistent order of width/color arguments for line style

pull/20/head
Emil Ernerfeldt 4 years ago
parent
commit
7b75bd2d09
  1. 4
      egui/src/containers/window.rs
  2. 2
      egui/src/demos/fractal_clock.rs
  3. 2
      egui/src/paint/command.rs
  4. 4
      egui/src/ui.rs
  5. 2
      egui/src/widgets.rs
  6. 2
      egui/src/widgets/text_edit.rs

4
egui/src/containers/window.rs

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

2
egui/src/demos/fractal_clock.rs

@ -134,7 +134,7 @@ impl FractalClock {
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 = [

2
egui/src/paint/command.rs

@ -42,7 +42,7 @@ pub enum 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 {
points,
style: LineStyle::new(width, color),

4
egui/src/ui.rs

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

2
egui/src/widgets.rs

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

2
egui/src/widgets/text_edit.rs

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

Loading…
Cancel
Save