Skip to content

Commit

Permalink
a multitude of canvas improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
justDeeevin committed Sep 26, 2024
1 parent c90cf26 commit 8e8f396
Show file tree
Hide file tree
Showing 2 changed files with 493 additions and 555 deletions.
35 changes: 25 additions & 10 deletions src/types/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Layout {
pub enum BoardElement {
KeyboardKey(KeyboardKeyDefinition),
MouseKey(MouseKeyDefinition),
MouseScroll(MouseScrollDefinition),
MouseScroll(MouseKeyDefinition),
MouseSpeedIndicator(MouseSpeedIndicatorDefinition),
}

Expand Down Expand Up @@ -85,18 +85,33 @@ pub struct MouseKeyDefinition {
pub text: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MouseScrollDefinition {
#[serde(rename = "Id")]
pub struct CommonDefinition {
pub id: u32,
#[serde(rename = "Boundaries")]
pub boundaries: Vec<SerializablePoint>,
#[serde(rename = "TextPosition")]
pub text_position: SerializablePoint,
#[serde(rename = "KeyCodes")]
pub boundaries: Vec<SerializablePoint>,
pub keycodes: Vec<u32>,
#[serde(rename = "Text")]
pub text: String,
}

impl From<KeyboardKeyDefinition> for CommonDefinition {
fn from(val: KeyboardKeyDefinition) -> Self {
CommonDefinition {
id: val.id,
text_position: val.text_position,
boundaries: val.boundaries,
keycodes: val.keycodes,
}
}
}

impl From<MouseKeyDefinition> for CommonDefinition {
fn from(val: MouseKeyDefinition) -> Self {
CommonDefinition {
id: val.id,
text_position: val.text_position,
boundaries: val.boundaries,
keycodes: val.keycodes,
}
}
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down
Loading

0 comments on commit 8e8f396

Please sign in to comment.