Add Frame setters for rounding, margin and shadow

This commit is contained in:
Emil Ernerfeldt 2021-07-20 14:33:36 +02:00
parent 12334addda
commit 06fc9afb1d

View file

@ -103,6 +103,22 @@ impl Frame {
self self
} }
pub fn corner_radius(mut self, corner_radius: f32) -> Self {
self.corner_radius = corner_radius;
self
}
/// Margin on each side of the frame.
pub fn margin(mut self, margin: impl Into<Vec2>) -> Self {
self.margin = margin.into();
self
}
pub fn shadow(mut self, shadow: Shadow) -> Self {
self.shadow = shadow;
self
}
pub fn multiply_with_opacity(mut self, opacity: f32) -> Self { pub fn multiply_with_opacity(mut self, opacity: f32) -> Self {
self.fill = self.fill.linear_multiply(opacity); self.fill = self.fill.linear_multiply(opacity);
self.stroke.color = self.stroke.color.linear_multiply(opacity); self.stroke.color = self.stroke.color.linear_multiply(opacity);