55 lines
1.2 KiB
Rust
55 lines
1.2 KiB
Rust
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
|
|
use serde::Deserialize;
|
|
|
|
use deckster_shared::path::{KeyPosition, KnobPosition};
|
|
use deckster_shared::style::KeyStyle;
|
|
|
|
use crate::model::geometry::UIntVec2;
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct File {
|
|
pub id: Option<String>,
|
|
pub scrolling: Option<ScrollingConfig>,
|
|
pub keys: HashMap<KeyPosition, Key>,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Page {
|
|
pub id: String,
|
|
pub scrolling: Option<ScrollingConfig>,
|
|
pub keys: HashMap<KeyPosition, Arc<Key>>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct ScrollingConfig {
|
|
pub knob: Option<KnobPosition>,
|
|
pub key: Option<ScrollingKeysConfig>,
|
|
pub delta: u8,
|
|
#[serde(default)]
|
|
pub axis: ScrollingConfigAxis,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct ScrollingKeysConfig {
|
|
pub previous: UIntVec2,
|
|
pub next: UIntVec2,
|
|
}
|
|
|
|
#[derive(Debug, Default, Eq, PartialEq, Hash, Deserialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub enum ScrollingConfigAxis {
|
|
#[default]
|
|
Vertical,
|
|
Horizontal,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct Key {
|
|
#[serde(default, flatten)]
|
|
pub base_style: KeyStyle,
|
|
|
|
pub handler: String,
|
|
pub config: Arc<toml::Table>,
|
|
}
|