Skip to content

Commit 5fccc95

Browse files
authored
Merge pull request #601 from 10ne1/master
element/basic_shapes: add two Rectangle getters/setters
2 parents 16714cf + 8235784 commit 5fccc95

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

plotters/src/element/basic_shapes.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,20 @@ impl<Coord> Rectangle<Coord> {
418418
self.margin = (t, b, l, r);
419419
self
420420
}
421+
422+
/// Get the points of the rectangle
423+
/// - returns the element points
424+
pub fn get_points(&self) -> (&Coord, &Coord) {
425+
(&self.points[0], &self.points[1])
426+
}
427+
428+
/// Set the style of the rectangle
429+
/// - `style`: The shape style
430+
/// - returns a mut reference to the rectangle
431+
pub fn set_style<S: Into<ShapeStyle>>(&mut self, style: S) -> &mut Self {
432+
self.style = style.into();
433+
self
434+
}
421435
}
422436

423437
impl<'a, Coord> PointCollection<'a, Coord> for &'a Rectangle<Coord> {

0 commit comments

Comments
 (0)