workspacesView: Use calculated workspace state for progress
It works just like before, except that this has the nice side effect of not changing the workspace mode when leaving the overview from the app grid state. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>
This commit is contained in:
parent
87645652e5
commit
ca066a4ba6
@ -233,16 +233,32 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
return Math.clamp(spacing, WORKSPACE_MIN_SPACING, WORKSPACE_MAX_SPACING);
|
return Math.clamp(spacing, WORKSPACE_MIN_SPACING, WORKSPACE_MAX_SPACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateWorkspacesState() {
|
_getWorkspaceModeForOverviewState(state) {
|
||||||
const { ControlsState } = OverviewControls;
|
const { ControlsState } = OverviewControls;
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case ControlsState.HIDDEN:
|
||||||
|
return 0;
|
||||||
|
case ControlsState.WINDOW_PICKER:
|
||||||
|
return 1;
|
||||||
|
case ControlsState.APP_GRID:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateWorkspacesState() {
|
||||||
const adj = this._scrollAdjustment;
|
const adj = this._scrollAdjustment;
|
||||||
const fitMode = this._fitModeAdjustment.value;
|
const fitMode = this._fitModeAdjustment.value;
|
||||||
const overviewState = this._overviewAdjustment.value;
|
|
||||||
|
|
||||||
const normalizedWorkspaceState = 1 -
|
const { initialState, finalState, progress } =
|
||||||
Math.abs(ControlsState.WINDOW_PICKER - overviewState);
|
this._overviewAdjustment.getStateTransitionParams();
|
||||||
const workspaceMode = Util.lerp(normalizedWorkspaceState, 0, fitMode);
|
|
||||||
|
const workspaceMode = (1 - fitMode) * Util.lerp(
|
||||||
|
this._getWorkspaceModeForOverviewState(initialState),
|
||||||
|
this._getWorkspaceModeForOverviewState(finalState),
|
||||||
|
progress);
|
||||||
|
|
||||||
// Fade and scale inactive workspaces
|
// Fade and scale inactive workspaces
|
||||||
this._workspaces.forEach((w, index) => {
|
this._workspaces.forEach((w, index) => {
|
||||||
@ -250,9 +266,9 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
|
|
||||||
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
||||||
|
|
||||||
const progress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
const scaleProgress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
||||||
|
|
||||||
const scale = Util.lerp(WORKSPACE_INACTIVE_SCALE, 1, progress);
|
const scale = Util.lerp(WORKSPACE_INACTIVE_SCALE, 1, scaleProgress);
|
||||||
w.set_scale(scale, scale);
|
w.set_scale(scale, scale);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user