pub trait AlignBbox: AlignBboxMut + Sized {
// Provided method
fn align_bbox(self, mode: AlignMode, other: impl Bbox, offset: i64) -> Self { ... }
}
Expand description
A geometric shape that can be aligned with another shape using their bounding boxes.
Takes in an owned copy of the shape and returns the aligned version.
§Examples
let mut rect1 = Rect::from_sides(0, 0, 100, 200);
let rect2 = Rect::from_sides(500, 600, 700, 700);
let rect1 = rect1.align_bbox(AlignMode::Left, rect2, 0);
assert_eq!(rect1.left(), rect2.left());
assert_eq!(rect1, Rect::from_sides(500, 0, 600, 200));
Provided Methods§
sourcefn align_bbox(self, mode: AlignMode, other: impl Bbox, offset: i64) -> Self
fn align_bbox(self, mode: AlignMode, other: impl Bbox, offset: i64) -> Self
Align self
using its bounding box and the bounding box of other
.
offset
represents an offset from the base alignment in the positive direction
along the alignment axis.
For center alignments, if the centers are a non-integer number of units apart, the translation amount is rounded down to the nearest integer. This behavior is subject to change and should not be relied upon.
Creates a new shape at the aligned location of the original.
Object Safety§
This trait is not object safe.