Commit 7d285bd5 authored by Jonas Dreßler's avatar Jonas Dreßler
Browse files

overviewControls: Make the swipe up gesture workspace move with finger

Since we now have a gesture where workspaces can be "pushed up" from the
bottom screen edge, it makes sense to move the workspaces in sync with
the finger movement. To achieve this, we change the swipeTracker
distance as soon as the threshold of the state WINDOW_PICKER is reached.

This isn't perfect though: The one progress change that crossed the
threshold will still use the old distance, even though a part of that
progress changed should have used the new distance. This can lead to the
workspace getting out of sync with the finger movement when moving the
finger quickly.
parent ec620c54
Pipeline #459411 waiting for manual action with stages
......@@ -431,7 +431,7 @@ var Overview = class extends Signals.EventEmitter {
}
_overviewGestureUpdate(tracker, progress) {
this._overview.controls.overviewGestureProgress(progress);
this._overview.controls.overviewGestureProgress(tracker, progress);
}
_overviewGestureEnd(tracker, duration, endProgress, endCb) {
......
......@@ -762,7 +762,6 @@ class ControlsManager extends St.Widget {
}
overviewGestureBegin(tracker) {
const baseDistance = global.screen_height;
const progress = this._stateAdjustment.value;
const points = [
ControlsState.HIDDEN,
......@@ -778,13 +777,40 @@ class ControlsManager extends St.Widget {
this._stateAdjustment.remove_transition('value');
}
tracker.confirmSwipe(baseDistance, points, progress, cancelProgress, wasEasingTo);
const hiddenBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.HIDDEN);
const windowPickerBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.WINDOW_PICKER);
const appGridBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.APP_GRID);
const distanceHiddenToWindowPicker = Math.abs(hiddenBox.y2 - windowPickerBox.y2);
const distanceWindowPickerToAppGrid = Math.abs(windowPickerBox.y2 - appGridBox.y2);
const distance = progress > ControlsState.WINDOW_PICKER
? distanceWindowPickerToAppGrid : distanceHiddenToWindowPicker;
tracker.confirmSwipe(distance, points, progress, cancelProgress, wasEasingTo);
this._workspacesDisplay.show();
this._searchController.prepareToEnterOverview();
this._stateAdjustment.gestureInProgress = true;
}
overviewGestureProgress(progress) {
overviewGestureProgress(tracker, progress) {
const oldProgress = this._stateAdjustment.value;
if ((oldProgress >= ControlsState.WINDOW_PICKER &&
progress < ControlsState.WINDOW_PICKER) ||
oldProgress <= ControlsState.WINDOW_PICKER &&
progress > ControlsState.WINDOW_PICKER) {
const hiddenBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.HIDDEN);
const windowPickerBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.WINDOW_PICKER);
const appGridBox = this.layoutManager.getWorkspacesBoxForState(ControlsState.APP_GRID);
const distanceHiddenToWindowPicker = Math.abs(hiddenBox.y2 - windowPickerBox.y2);
const distanceWindowPickerToAppGrid = Math.abs(windowPickerBox.y2 - appGridBox.y2);
tracker.distance = progress > ControlsState.WINDOW_PICKER
? distanceWindowPickerToAppGrid : distanceHiddenToWindowPicker;
}
this._stateAdjustment.value = progress;
}
......
Supports Markdown
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