bevy_mod_stylebuilder 0.1.3

A set of fluent builder utilities for Bevy UI styles.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::builder::{StyleBuilder, ZIndexParam};
use bevy::ui::ZIndex;

#[allow(missing_docs)]
pub trait StyleBuilderZIndex {
    fn z_index(&mut self, index: impl ZIndexParam) -> &mut Self;
}

impl<'a, 'w> StyleBuilderZIndex for StyleBuilder<'a, 'w> {
    fn z_index(&mut self, index: impl ZIndexParam) -> &mut Self {
        match index.to_val() {
            ZIndex::Local(0) => self.target.remove::<ZIndex>(),
            val => self.target.insert(val),
        };
        self
    }
}