elevation.rs

 1#[doc = include_str!("elevation.md")]
 2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 3pub enum Elevation {
 4    ElevationIndex(ElevationIndex),
 5    LayerIndex(LayerIndex),
 6    ElementIndex(ElementIndex),
 7}
 8
 9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum ElevationIndex {
11    AppBackground,
12    UISurface,
13    ElevatedSurface,
14    Wash,
15    ModalSurfaces,
16    DraggedElement,
17}
18
19impl ElevationIndex {
20    pub fn usize(&self) -> usize {
21        match *self {
22            ElevationIndex::AppBackground => 0,
23            ElevationIndex::UISurface => 100,
24            ElevationIndex::ElevatedSurface => 200,
25            ElevationIndex::Wash => 300,
26            ElevationIndex::ModalSurfaces => 400,
27            ElevationIndex::DraggedElement => 900,
28        }
29    }
30}
31
32#[derive(Debug, Clone, Copy, PartialEq, Eq)]
33pub enum LayerIndex {
34    BehindElement,
35    Element,
36    ElevatedElement,
37}
38
39impl LayerIndex {
40    pub fn usize(&self) -> usize {
41        match *self {
42            LayerIndex::BehindElement => 0,
43            LayerIndex::Element => 100,
44            LayerIndex::ElevatedElement => 200,
45        }
46    }
47}
48
49#[derive(Debug, Clone, Copy, PartialEq, Eq)]
50pub enum ElementIndex {
51    Effect,
52    Background,
53    Tint,
54    Highlight,
55    Content,
56    Overlay,
57}
58
59impl ElementIndex {
60    pub fn usize(&self) -> usize {
61        match *self {
62            ElementIndex::Effect => 0,
63            ElementIndex::Background => 100,
64            ElementIndex::Tint => 200,
65            ElementIndex::Highlight => 300,
66            ElementIndex::Content => 400,
67            ElementIndex::Overlay => 500,
68        }
69    }
70}