Skip to content

Commit

Permalink
chore: 🤖 remove the Direction enum
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed Jan 15, 2024
1 parent 0a8cb2d commit da26d71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
8 changes: 1 addition & 7 deletions dotlottie-ffi/src/dotlottie_player.udl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ namespace dotlottie_player {
enum Mode {
"Forward",
"Reverse",
"ForwardBounce",
"Bounce",
"ReverseBounce"
};

enum Direction {
"Forward",
"Reverse"
};

dictionary Config {
boolean autoplay;
boolean loop_animation;
Expand Down Expand Up @@ -45,5 +40,4 @@ interface DotLottiePlayer {
boolean render();
boolean resize(u32 width, u32 height);
void clear();
Direction direction();
};
21 changes: 6 additions & 15 deletions dotlottie-rs/src/dotlottie_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ pub enum PlaybackState {
pub enum Mode {
Forward,
Reverse,
ForwardBounce,
Bounce,
ReverseBounce,
}

#[derive(PartialEq, Clone, Copy)]
pub enum Direction {
enum Direction {
Forward,
Reverse,
}
Expand Down Expand Up @@ -46,7 +45,7 @@ impl DotLottieRuntime {
let direction = match config.mode {
Mode::Forward => Direction::Forward,
Mode::Reverse => Direction::Reverse,
Mode::ForwardBounce => Direction::Forward,
Mode::Bounce => Direction::Forward,
Mode::ReverseBounce => Direction::Reverse,
};

Expand All @@ -61,10 +60,6 @@ impl DotLottieRuntime {
}
}

pub fn direction(&self) -> Direction {
self.direction
}

pub fn is_loaded(&self) -> bool {
self.is_loaded
}
Expand Down Expand Up @@ -117,7 +112,7 @@ impl DotLottieRuntime {
let end_frame = self.total_frames() - 1.0;

match self.config.mode {
Mode::Forward | Mode::ForwardBounce => {
Mode::Forward | Mode::Bounce => {
self.set_frame(start_frame);
}
Mode::Reverse | Mode::ReverseBounce => {
Expand Down Expand Up @@ -187,7 +182,7 @@ impl DotLottieRuntime {
next_frame
}
}
Mode::ForwardBounce => match self.direction {
Mode::Bounce => match self.direction {
Direction::Forward => {
if next_frame >= total_frames {
self.direction = Direction::Reverse;
Expand Down Expand Up @@ -295,7 +290,7 @@ impl DotLottieRuntime {
let end_frame = self.total_frames() - 1.0;

match self.config.mode {
Mode::Forward | Mode::ForwardBounce => {
Mode::Forward | Mode::Bounce => {
self.set_frame(first_frame);
self.direction = Direction::Forward;
}
Expand Down Expand Up @@ -449,10 +444,6 @@ impl DotLottiePlayer {
pub fn config(&self) -> Config {
self.runtime.read().unwrap().config()
}

pub fn direction(&self) -> Direction {
self.runtime.read().unwrap().direction()
}
}

unsafe impl Send for DotLottiePlayer {}
Expand Down

0 comments on commit da26d71

Please sign in to comment.