Skip to content

Commit

Permalink
GesturePropertyTransition: Only call done_callback if the transition …
Browse files Browse the repository at this point in the history
…finished (#2201)
  • Loading branch information
leolost2605 authored Jan 4, 2025
1 parent a648353 commit e0cd37a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Gestures/GesturePropertyTransition.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public class Gala.GesturePropertyTransition : Object {
* to the final position. If with_gesture is false it will just ease to the {@link to_value}.
* #this will keep itself alive until the animation finishes so it is safe to immediatly unref it after creation and calling start.
*
* @param done_callback a callback for when the transition finishes. It is guaranteed to be called exactly once.
* @param done_callback a callback for when the transition finishes. This shouldn't be used for setting state, instead state should
* be set immediately on {@link GestureTracker.OnEnd} not only once the animation ends to allow for interrupting the animation by starting a new gesture.
* done_callback will only be called if the animation finishes, not if it is interrupted e.g. by starting a new animation for the same property,
* destroying the actor or removing the transition.
*/
public void start (bool with_gesture, owned DoneCallback? done_callback = null) {
ref ();
Expand Down Expand Up @@ -179,8 +182,8 @@ public class Gala.GesturePropertyTransition : Object {
}
}

private void finish () {
if (done_callback != null) {
private void finish (bool callback = true) {
if (done_callback != null && callback) {
done_callback ();
}

Expand Down

0 comments on commit e0cd37a

Please sign in to comment.