shared/domain/module/body/legacy/
design.rs

1pub use super::*;
2use serde::{Deserialize, Serialize};
3use serde_with::skip_serializing_none;
4
5#[derive(Serialize, Deserialize, Debug, Clone, Default)]
6pub struct Design {
7    /// Background layer
8    pub bgs: Vec<String>,
9
10    /// Stickers layer
11    pub stickers: Vec<Sticker>,
12}
13
14#[skip_serializing_none]
15#[derive(Serialize, Deserialize, Debug, Clone)]
16pub struct Sticker {
17    pub filename: String,
18    pub transform_matrix: [f64; 16],
19    /// hide and hide_toggle are mapped from the top sections
20    /// in "Houdini": HideOnTap, ShowOnTap, and ToggleOnTap
21    /// start out hidden
22    pub hide: bool,
23    /// toggle hidden state
24    pub hide_toggle: Option<HideToggle>,
25
26    /// animation options are mapped from the bottom animation section
27    pub animation: Option<Animation>,
28    // associated audio
29    pub audio_filename: Option<String>,
30
31    /// override the size
32    pub override_size: Option<(f64, f64)>,
33
34    /// the original sticker kind
35    /// ideally we'd ditch this
36    /// but it's helpful for debugging
37    pub kind: StickerKind,
38}
39
40#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
41#[serde(rename_all = "snake_case")]
42pub enum StickerKind {
43    Background,
44    Animation,
45    Image,
46    Text(Option<String>),
47}
48
49#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
50#[serde(rename_all = "snake_case")]
51pub enum HideToggle {
52    /// only let the toggle fire once
53    Once,
54    /// let the toggle fire indefinitely
55    Always,
56}
57
58#[derive(Serialize, Deserialize, Debug, Clone)]
59pub struct Animation {
60    /// do not let the animation loop
61    pub once: bool,
62    /// wait for tap before playing
63    pub tap: bool,
64}