diff --git a/lib/Gestures/PropertyTarget.vala b/lib/Gestures/PropertyTarget.vala index e828b6d53..dc1566640 100644 --- a/lib/Gestures/PropertyTarget.vala +++ b/lib/Gestures/PropertyTarget.vala @@ -10,11 +10,24 @@ public class Gala.PropertyTarget : Object, GestureTarget { // Don't take a reference since we are most of the time owned by the target public weak Object? target { get; private set; } public string property { get; construct; } - + public bool allow_overshoot { get; construct; } public Clutter.Interval interval { get; construct; } - public PropertyTarget (GestureAction action, Object target, string property, Type value_type, Value from_value, Value to_value) { - Object (action: action, property: property, interval: new Clutter.Interval.with_values (value_type, from_value, to_value)); + public PropertyTarget ( + GestureAction action, + Object target, + string property, + Type value_type, + Value from_value, + Value to_value, + bool allow_overshoot = false + ) { + Object ( + action: action, + property: property, + interval: new Clutter.Interval.with_values (value_type, from_value, to_value), + allow_overshoot: allow_overshoot + ); this.target = target; this.target.weak_ref (on_target_disposed); @@ -35,6 +48,10 @@ public class Gala.PropertyTarget : Object, GestureTarget { return; } + if (!allow_overshoot) { + progress = progress.clamp (0.0, 1.0); + } + target.set_property (property, interval.compute (progress)); } } diff --git a/src/Widgets/MultitaskingView/MultitaskingView.vala b/src/Widgets/MultitaskingView/MultitaskingView.vala index 4ac4ba68f..00b32d5d8 100644 --- a/src/Widgets/MultitaskingView/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView/MultitaskingView.vala @@ -61,7 +61,10 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone opened = false; display = wm.get_display (); - multitasking_gesture_controller = new GestureController (MULTITASKING_VIEW, wm, MULTITASKING_VIEW); + multitasking_gesture_controller = new GestureController (MULTITASKING_VIEW, wm, MULTITASKING_VIEW) { + overshoot_upper_clamp = 1.1, + overshoot_lower_clamp = -0.1 + }; multitasking_gesture_controller.enable_touchpad (wm.stage); add_gesture_controller (multitasking_gesture_controller); diff --git a/src/Widgets/MultitaskingView/WorkspaceClone.vala b/src/Widgets/MultitaskingView/WorkspaceClone.vala index 6d9132a15..3296a8765 100644 --- a/src/Widgets/MultitaskingView/WorkspaceClone.vala +++ b/src/Widgets/MultitaskingView/WorkspaceClone.vala @@ -239,9 +239,9 @@ public class Gala.WorkspaceClone : ActorTarget { var initial_width = monitor.width; var target_width = monitor.width * scale + WorkspaceRow.WORKSPACE_GAP * 2; - add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width)); - add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale)); - add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale)); + add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width, true)); + add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale, true)); + add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale, true)); window_container.padding_top = Utils.scale_to_int (TOP_OFFSET, monitor_scale); window_container.padding_left = window_container.padding_right = (int) (monitor.width - monitor.width * scale) / 2;