From 12f9d6f42c2ba98c6c3104d6409fe6e105b3d524 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 26 Nov 2024 15:17:47 +0100 Subject: [PATCH] add painter.line() (#5291) * Closes * [x] I have followed the instructions in the PR template --- crates/egui/src/painter.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/egui/src/painter.rs b/crates/egui/src/painter.rs index 5b8ae77df37..232450e3862 100644 --- a/crates/egui/src/painter.rs +++ b/crates/egui/src/painter.rs @@ -344,6 +344,12 @@ impl Painter { }) } + /// Paints a line connecting the points. + /// NOTE: all coordinates are screen coordinates! + pub fn line(&self, points: Vec, stroke: impl Into) -> ShapeIdx { + self.add(Shape::line(points, stroke)) + } + /// Paints a horizontal line. pub fn hline(&self, x: impl Into, y: f32, stroke: impl Into) -> ShapeIdx { self.add(Shape::hline(x, y, stroke.into()))