Open Resonanz opened 1 month ago
The method you linked is on the Shape
struct, not the Painter
. You should be able to do painter.add(Shape::line(...))
. But it would make sense to add a Painter::line
function as well 👍🏻
Thanks, you are right, that worked:
let mut v = Vec::new();
v.push(Pos2 {
x: locx + 0.,
y: locy + 0.,
});
v.push(Pos2 {
x: locx + 70.,
y: locy + 0.,
});
v.push(Pos2 {
x: locx + 70.,
y: locy + 70.,
});
v.push(Pos2 {
x: locx + 0.,
y: locy + 70.,
});
v.push(Pos2 {
x: locx + 0.,
y: locy + 0.,
});
ui.painter().add(Shape::line(v, (1., Color32::LIGHT_BLUE)));
This is also how it is done in the Spinner widget.
https://docs.rs/egui/latest/egui/enum.Shape.html#method.line
To Reproduce
There are no problem using
line_segment
rather than ```line'''.Desktop (please complete the following information):