@@ -365,46 +365,13 @@ namespace Gala {
365365
366366 var scale = (float )(monitor. height - InternalUtils . scale_to_int (TOP_OFFSET + BOTTOM_OFFSET , scale_factor)) / monitor. height;
367367 var pivot_y = InternalUtils . scale_to_int (TOP_OFFSET , scale_factor) / (monitor. height - monitor. height * scale);
368+ background. set_pivot_point (0.5f , pivot_y);
368369
369370 update_size (monitor);
370371
371- GestureTracker . OnBegin on_animation_begin = () = > {
372- x = initial_x;
373- background. set_pivot_point (0.5f , pivot_y);
374- };
375-
376- GestureTracker . OnUpdate on_animation_update = (percentage) = > {
377- var x = GestureTracker . animation_value (initial_x, target_x, percentage);
378- set_x (x);
379-
380- var update_scale = (double ) GestureTracker . animation_value (1.0f , (float )scale, percentage);
381- background. set_scale (update_scale, update_scale);
382- };
383-
384- GestureTracker . OnEnd on_animation_end = (percentage, cancel_action) = > {
385- if (cancel_action) {
386- return ;
387- }
388-
389- save_easing_state ();
390- set_easing_mode (Clutter . AnimationMode . EASE_OUT_QUAD );
391- set_easing_duration (wm. enable_animations ? MultitaskingView . ANIMATION_DURATION : 0 );
392- set_x (target_x);
393- restore_easing_state ();
394-
395- background. save_easing_state ();
396- background. set_easing_mode (Clutter . AnimationMode . EASE_OUT_QUAD );
397- background. set_easing_duration (wm. enable_animations ? MultitaskingView . ANIMATION_DURATION : 0 );
398- background. set_scale (scale, scale);
399- background. restore_easing_state ();
400- };
401-
402- if (! with_gesture || ! wm. enable_animations) {
403- on_animation_begin (0 );
404- on_animation_end (1 , false , 0 );
405- } else {
406- gesture_tracker. connect_handlers ((owned ) on_animation_begin, (owned ) on_animation_update, (owned )on_animation_end);
407- }
372+ new PropertyGestureTransition (this , gesture_tracker, " x" , initial_x, target_x, with_gesture);
373+ new PropertyGestureTransition (background, gesture_tracker, " scale-x" , 1.0f , (float ) scale, with_gesture);
374+ new PropertyGestureTransition (background, gesture_tracker, " scale-y" , 1.0f , (float ) scale, with_gesture);
408375
409376#if HAS_MUTTER45
410377 Mtk . Rectangle area = {
@@ -448,38 +415,9 @@ namespace Gala {
448415 double initial_scale_x, initial_scale_y;
449416 background. get_scale (out initial_scale_x, out initial_scale_y);
450417
451- GestureTracker . OnUpdate on_animation_update = (percentage) = > {
452- var x = GestureTracker . animation_value (initial_x, target_x, percentage);
453- set_x (x);
454-
455- double scale_x = (double ) GestureTracker . animation_value ((float ) initial_scale_x, 1.0f , percentage);
456- double scale_y = (double ) GestureTracker . animation_value ((float ) initial_scale_y, 1.0f , percentage);
457- background. set_scale (scale_x, scale_y);
458- };
459-
460- GestureTracker . OnEnd on_animation_end = (percentage, cancel_action) = > {
461- if (cancel_action) {
462- return ;
463- }
464-
465- save_easing_state ();
466- set_easing_mode (Clutter . AnimationMode . EASE_OUT_QUAD );
467- set_easing_duration (wm. enable_animations ? MultitaskingView . ANIMATION_DURATION : 0 );
468- set_x (target_x);
469- restore_easing_state ();
470-
471- background. save_easing_state ();
472- background. set_easing_mode (Clutter . AnimationMode . EASE_OUT_QUAD );
473- background. set_easing_duration (wm. enable_animations ? MultitaskingView . ANIMATION_DURATION : 0 );
474- background. set_scale (1 , 1 );
475- background. restore_easing_state ();
476- };
477-
478- if (! with_gesture || ! wm. enable_animations) {
479- on_animation_end (1 , false , 0 );
480- } else {
481- gesture_tracker. connect_handlers (null , (owned ) on_animation_update, (owned ) on_animation_end);
482- }
418+ new PropertyGestureTransition (this , gesture_tracker, " x" , initial_x, target_x, with_gesture);
419+ new PropertyGestureTransition (background, gesture_tracker, " scale-x" , initial_scale_x, 1.0f , with_gesture);
420+ new PropertyGestureTransition (background, gesture_tracker, " scale-y" , initial_scale_y, 1.0f , with_gesture);
483421
484422 window_container. close (with_gesture, is_cancel_animation);
485423 }
0 commit comments