swoop_ui/shadow.rs
1use bevy_ui::prelude::*;
2
3use crate::View;
4
5/// A trait for setting and modifying UI container shadow styles.
6pub trait ShadowView: View {
7 /// Returns a mutable reference to the internal shadow style list.
8 fn shadow_node(&mut self) -> &mut BoxShadow;
9
10 /// Replaces all existing shadows with the provided list.
11 fn shadow(mut self, shadows: Vec<ShadowStyle>) -> Self {
12 self.shadow_node().0 = shadows;
13 self
14 }
15
16 /// Appends a new shadow to the current list.
17 fn add_shadow(mut self, shadow: ShadowStyle) -> Self {
18 self.shadow_node().0.push(shadow);
19 self
20 }
21}