From 06fc9afb1de3235e6e5351e5756a86016f6e13d1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 20 Jul 2021 14:33:36 +0200 Subject: [PATCH] Add Frame setters for rounding, margin and shadow --- egui/src/containers/frame.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/egui/src/containers/frame.rs b/egui/src/containers/frame.rs index 169f60574..a81710bc5 100644 --- a/egui/src/containers/frame.rs +++ b/egui/src/containers/frame.rs @@ -103,6 +103,22 @@ impl Frame { 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) -> 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 { self.fill = self.fill.linear_multiply(opacity); self.stroke.color = self.stroke.color.linear_multiply(opacity);