11import Clutter from '@gi-types/clutter' ;
22import Shell from '@gi-types/shell' ;
33import { global , imports } from 'gnome-shell' ;
4+ import { OverviewNavigationState } from '../common/settings' ;
45import { ExtSettings , OverviewControlsState } from '../constants' ;
56import { createSwipeTracker } from './swipeTracker' ;
67
@@ -24,7 +25,10 @@ export class OverviewRoundTripGestureExtension implements ISubExtension {
2425 private _connectors : number [ ] ;
2526 private _shownEventId = 0 ;
2627 private _hiddenEventId = 0 ;
27- constructor ( ) {
28+ private _navigationStates : OverviewNavigationState ;
29+
30+ constructor ( navigationStates : OverviewNavigationState ) {
31+ this . _navigationStates = navigationStates ;
2832 this . _overviewControls = Main . overview . _overview . _controls ;
2933 this . _stateAdjustment = this . _overviewControls . _stateAdjustment ;
3034 this . _oldGetStateTransitionParams = this . _overviewControls . _stateAdjustment . getStateTransitionParams ;
@@ -98,12 +102,10 @@ export class OverviewRoundTripGestureExtension implements ISubExtension {
98102
99103 _gestureBegin ( tracker : typeof SwipeTracker . prototype ) : void {
100104 const _tracker = {
101- confirmSwipe : ( distance : number , snapPoints : number [ ] , currentProgress : number , cancelProgress : number ) => {
102- snapPoints . unshift ( OverviewControlsState . APP_GRID_P ) ;
103- snapPoints . push ( OverviewControlsState . HIDDEN_N ) ;
105+ confirmSwipe : ( distance : number , _snapPoints : number [ ] , currentProgress : number , cancelProgress : number ) => {
104106 tracker . confirmSwipe (
105107 distance ,
106- snapPoints ,
108+ this . _getGestureSnapPoints ( ) ,
107109 currentProgress ,
108110 cancelProgress ,
109111 ) ;
@@ -171,4 +173,28 @@ export class OverviewRoundTripGestureExtension implements ISubExtension {
171173
172174 return progress ;
173175 }
176+
177+ private _getGestureSnapPoints ( ) : number [ ] {
178+ switch ( this . _navigationStates ) {
179+ case OverviewNavigationState . CYCLIC :
180+ return [
181+ OverviewControlsState . APP_GRID_P ,
182+ OverviewControlsState . HIDDEN ,
183+ OverviewControlsState . WINDOW_PICKER ,
184+ OverviewControlsState . APP_GRID ,
185+ OverviewControlsState . HIDDEN_N ,
186+ ] ;
187+ case OverviewNavigationState . GNOME :
188+ return [
189+ OverviewControlsState . HIDDEN ,
190+ OverviewControlsState . WINDOW_PICKER ,
191+ OverviewControlsState . APP_GRID ,
192+ ] ;
193+ case OverviewNavigationState . WINDOW_PICKER_ONLY :
194+ return [
195+ OverviewControlsState . HIDDEN ,
196+ OverviewControlsState . WINDOW_PICKER ,
197+ ] ;
198+ }
199+ }
174200}
0 commit comments