workspacesView: Derive workspace state from fit mode
Derive the workspace state WorkspacesView's workspaces from the fit mode. Extra workspaces still run the zoom animations as before. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1613>
This commit is contained in:
parent
176ea3b1ef
commit
1adcbaab46
@ -1341,4 +1341,8 @@ class Workspace extends St.Widget {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get stateAdjustment() {
|
||||||
|
return this.layout_manager.stateAdjustment;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -217,9 +217,12 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
|
|
||||||
_updateWorkspacesState() {
|
_updateWorkspacesState() {
|
||||||
const adj = this._scrollAdjustment;
|
const adj = this._scrollAdjustment;
|
||||||
|
const fitMode = this._fitModeAdjustment.value;
|
||||||
|
|
||||||
// Fade and scale inactive workspaces
|
// Fade and scale inactive workspaces
|
||||||
this._workspaces.forEach((w, index) => {
|
this._workspaces.forEach((w, index) => {
|
||||||
|
w.stateAdjustment.value = Util.lerp(1, 0, fitMode);
|
||||||
|
|
||||||
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
||||||
|
|
||||||
const progress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
const progress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
||||||
@ -290,14 +293,12 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
animateToOverview() {
|
animateToOverview() {
|
||||||
for (let w = 0; w < this._workspaces.length; w++)
|
|
||||||
this._workspaces[w].zoomToOverview();
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
animateFromOverview() {
|
animateFromOverview() {
|
||||||
for (let w = 0; w < this._workspaces.length; w++)
|
for (let w = 0; w < this._workspaces.length; w++)
|
||||||
this._workspaces[w].zoomFromOverview();
|
this._workspaces[w].prepareToLeaveOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
syncStacking(stackIndices) {
|
syncStacking(stackIndices) {
|
||||||
|
Loading…
Reference in New Issue
Block a user