Commit 5432d271 authored by Xiaodan Zhu's avatar Xiaodan Zhu Committed by Commit Bot

Flip desk gesture for enhanced animation.

This CL changes the direction of switching desk gestures when
enhanced desks animation is enabled. The alert toast is shown
when the user performs the wrong gestures on the first and last
desks.

Test: manual.

Bug: 1140242
Change-Id: Ie67e3fb8ff4cea9afc6417e70046533077e09750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2520238Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Xiaodan Zhu <zxdan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824624}
parent b6a90360
......@@ -284,14 +284,16 @@ bool WmGestureHandler::ProcessEventImpl(int finger_count,
if (is_enhanced_desk_animations_ && finger_count == 4) {
DCHECK(!moved);
// Horizon gesture may be flipped.
const float offset_x = GetOffset(-delta_x);
const float scroll_x = GetOffset(scroll_data_->scroll_x);
auto* desks_controller = DesksController::Get();
// Update the continuous desk animation if it has already been started,
// otherwise start it if it passes the threshold.
if (scroll_data_->continuous_gesture_started) {
DesksController::Get()->UpdateSwipeAnimation(delta_x);
} else if (std::abs(scroll_data_->scroll_x) >
kContinuousGestureMoveThresholdDp) {
if (!DesksController::Get()->StartSwipeAnimation(
/*move_left=*/delta_x > 0)) {
desks_controller->UpdateSwipeAnimation(offset_x);
} else if (std::abs(scroll_x) > kContinuousGestureMoveThresholdDp) {
if (!desks_controller->StartSwipeAnimation(/*move_left=*/offset_x > 0)) {
// Starting an animation failed. This can happen if we are on the
// lockscreen or an ongoing animation from a different source is
// happening. In this case reset |scroll_data_| and wait for the next 4
......@@ -299,6 +301,9 @@ bool WmGestureHandler::ProcessEventImpl(int finger_count,
scroll_data_.reset();
return false;
}
MaybeHandleWrongHorizontalGesture(/*move_left=*/scroll_x < 0,
desks_controller->GetPreviousDesk(),
desks_controller->GetNextDesk());
scroll_data_->continuous_gesture_started = true;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment