@@ -374,7 +374,7 @@ impl<T> Tween<T> {
374374 /// # end: Vec3::new(3.5, 0., 0.),
375375 /// # },
376376 /// )
377- /// .with_completed_event(true, 42);
377+ /// .with_completed_event(42);
378378 ///
379379 /// fn my_system(mut reader: EventReader<TweenCompleted>) {
380380 /// for ev in reader.iter() {
@@ -386,8 +386,8 @@ impl<T> Tween<T> {
386386 ///
387387 /// [`set_completed()`]: Tween::set_completed
388388 #[ must_use]
389- pub fn with_completed_event ( mut self , enabled : bool , user_data : u64 ) -> Self {
390- self . event_data = if enabled { Some ( user_data) } else { None } ;
389+ pub fn with_completed_event ( mut self , user_data : u64 ) -> Self {
390+ self . event_data = Some ( user_data) ;
391391 self
392392 }
393393
@@ -425,7 +425,7 @@ impl<T> Tween<T> {
425425 self . direction
426426 }
427427
428- /// Set a callback invoked when the animation completed .
428+ /// Set a callback invoked when the animation completes .
429429 ///
430430 /// The callback when invoked receives as parameters the [`Entity`] on which
431431 /// the target and the animator are, as well as a reference to the
@@ -439,7 +439,7 @@ impl<T> Tween<T> {
439439 self . on_completed = Some ( Box :: new ( callback) ) ;
440440 }
441441
442- /// Clear the callback invoked when the animation completed .
442+ /// Clear the callback invoked when the animation completes .
443443 pub fn clear_completed ( & mut self ) {
444444 self . on_completed = None ;
445445 }
@@ -454,8 +454,13 @@ impl<T> Tween<T> {
454454 ///
455455 /// [`set_completed()`]: Tween::set_completed
456456 /// [`with_completed_event()`]: Tween::with_completed_event
457- pub fn set_completed_event ( & mut self , enabled : bool , user_data : u64 ) {
458- self . event_data = if enabled { Some ( user_data) } else { None } ;
457+ pub fn set_completed_event ( & mut self , user_data : u64 ) {
458+ self . event_data = Some ( user_data) ;
459+ }
460+
461+ /// Clear the event sent when the animation completes.
462+ pub fn clear_completed_event ( & mut self ) {
463+ self . event_data = None ;
459464 }
460465}
461466
@@ -959,7 +964,7 @@ mod tests {
959964
960965 // Activate event sending
961966 const USER_DATA : u64 = 54789 ; // dummy
962- tween. set_completed_event ( true , USER_DATA ) ;
967+ tween. set_completed_event ( USER_DATA ) ;
963968 assert ! ( tween. event_data. is_some( ) ) ;
964969 assert_eq ! ( tween. event_data. unwrap( ) , USER_DATA ) ;
965970
0 commit comments