Ran into the case where I needed to expand the bounds of a layout by a specific Padding rather than a single f32.
Right now the expand method on Rectangle takes a single f32 to perform uniform expansion, would be a nice enhancement to make the expansion more generic.
fn expand(self, padding: impl Into<Padding>) -> Self {
let padding: Padding = padding.into();
Self {
x: self.x - padding.left,
y: self.y - padding.top,
width: self.width + padding.left + padding.right,
height: self.height + padding.left + padding.right,
}
}
This will keep the same behavior as before, since f32 has an Into for Padding and all the arithmetic works out to being the same.