Skip to content

Commit

Permalink
Fix refs
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Dec 15, 2024
1 parent 3973ad0 commit 06a0b63
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Gestures/GesturePropertyTransition.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class Gala.GesturePropertyTransition : Object {
* value of the target property, when calling {@link start}.
*/
private Value actual_from_value;
private float from_value_float; // Only valid in the time between start () and finish ()
private float to_value_float; // Only valid in the time between start () and finish ()

private DoneCallback? done_callback;

Expand Down Expand Up @@ -107,16 +109,17 @@ public class Gala.GesturePropertyTransition : Object {
}

// Pre calculate some things, so we don't have to do it on every update
var from_value_float = value_to_float (actual_from_value);
var to_value_float = value_to_float (to_value);
var lower_clamp_int = (int) overshoot_lower_clamp;
var upper_clamp_int = (int) overshoot_upper_clamp;
from_value_float = value_to_float (actual_from_value);
to_value_float = value_to_float (to_value);

GestureTracker.OnBegin on_animation_begin = () => {
actor.set_property (property, actual_from_value);
};

GestureTracker.OnUpdate on_animation_update = (percentage) => {
var lower_clamp_int = (int) overshoot_lower_clamp;
var upper_clamp_int = (int) overshoot_upper_clamp;

double stretched_percentage = 0;
if (percentage < lower_clamp_int) {
stretched_percentage = (percentage - lower_clamp_int) * - (overshoot_lower_clamp - lower_clamp_int);
Expand All @@ -136,7 +139,7 @@ public class Gala.GesturePropertyTransition : Object {
};

GestureTracker.OnEnd on_animation_end = (percentage, completions, calculated_duration) => {
completions = completions.clamp (lower_clamp_int, upper_clamp_int);
completions = completions.clamp ((int) overshoot_lower_clamp, (int) overshoot_upper_clamp);
var target_value = from_value_float + completions * (to_value_float - from_value_float);

actor.save_easing_state ();
Expand Down

0 comments on commit 06a0b63

Please sign in to comment.