Skip to content

Commit

Permalink
feat: moved pointer target to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelOsborne committed Jun 6, 2024
1 parent 25a60d2 commit f664783
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions dotlottie-rs/src/state_machine/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,27 @@ pub struct OnCompleteEventJson {}

#[derive(Deserialize, Debug, PartialEq)]
pub struct OnPointerDownEventJson {
pub target: String,
pub target: Option<String>,
}

#[derive(Deserialize, Debug, PartialEq)]
pub struct OnPointerUpEventJson {
pub target: String,
pub target: Option<String>,
}

#[derive(Deserialize, Debug, PartialEq)]
pub struct OnPointerEnterEventJson {
pub target: String,
pub target: Option<String>,
}

#[derive(Deserialize, Debug, PartialEq)]
pub struct OnPointerExitEventJson {
pub target: String,
pub target: Option<String>,
}

#[derive(Deserialize, Debug, PartialEq)]
pub struct OnPointerMoveEventJson {
pub target: String,
pub target: Option<String>,
}

#[derive(Deserialize, Debug, PartialEq)]
Expand Down
12 changes: 5 additions & 7 deletions examples/demo-state-machine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ fn main() {
..Config::default()
});

let mut markers = File::open("src/exploding-pigeons-test-file.lottie").expect("no file found");
let mut markers = File::open("src/pigeon_with_listeners.lottie").expect("no file found");
let metadatamarkers =
fs::metadata("src/exploding-pigeons-test-file.lottie").expect("unable to read metadata");
fs::metadata("src/pigeon_with_listeners.lottie").expect("unable to read metadata");
let mut markers_buffer = vec![0; metadatamarkers.len() as usize];
markers.read(&mut markers_buffer).expect("buffer overflow");

Expand Down Expand Up @@ -183,7 +183,7 @@ fn main() {

let mut cpu_memory_monitor_timer = Instant::now();

lottie_player.load_state_machine("exploding_pigeon");
lottie_player.load_state_machine("pigeon_fsm");
lottie_player.start_state_machine();
lottie_player.play();

Expand All @@ -202,12 +202,10 @@ fn main() {
}

if window.is_key_pressed(Key::O, KeyRepeat::No) {
let string_event = Event::String {
value: "complete".to_string(),
};
let pointer_event = Event::OnPointerDown { x: 1.0, y: 1.0 };

let p = &mut *locked_player.write().unwrap();
p.post_event(&string_event);
p.post_event(&pointer_event);
}

if window.is_key_pressed(Key::P, KeyRepeat::No) {
Expand Down
Binary file not shown.

0 comments on commit f664783

Please sign in to comment.