diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 135168194ca9eaac15601c92f75b6d14ab0553df..07560faec212eea362db3a975ed6e16a263d95dd 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -724,7 +724,7 @@ class ControlsManager extends St.Widget { this._stateAdjustment.value = ControlsState.HIDDEN; this._stateAdjustment.ease(state, { duration: Overview.ANIMATION_TIME, - mode: Clutter.AnimationMode.EASE_OUT_SINE, + mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD, onStopped: () => { if (callback) callback(); diff --git a/js/ui/workspace.js b/js/ui/workspace.js index ccd23ae6b13b3a5879f9cba4c399fc82e94911af..d3ea85fd82e98a59cf9bca52ae036ec3b795431f 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -63,7 +63,7 @@ const BACKGROUND_CORNER_RADIUS_PIXELS = 30; // computing an optimal scale for each window that fits the constraints, // and doesn't make the thumbnail too small to see. There are two factors // involved in thumbnail scale to make sure that these two goals are met: -// the window scale (calculated by _computeWindowScale) and the layout +// the window scale (calculated by computeWindowScale) and the layout // scale (calculated by computeSizeAndScale). // // The calculation logic becomes slightly more complicated because row @@ -163,24 +163,6 @@ class UnalignedLayoutStrategy extends LayoutStrategy { }; } - // Computes and returns an individual scaling factor for @window, - // to be applied in addition to the overall layout scale. - _computeWindowScale(window) { - // Since we align windows next to each other, the height of the - // thumbnails is much more important to preserve than the width of - // them, so two windows with equal height, but maybe differering - // widths line up. - const ratio = window.boundingBox.height / this._monitor.height; - - // The purpose of this manipulation here is to prevent windows - // from getting too small. For something like a calculator window, - // we need to bump up the size just a bit to make sure it looks - // good. We'll use a multiplier of 1.5 for this. - - // Map from [0, 1] to [1.5, 1] - return Util.lerp(1.5, 1, ratio); - } - _computeRowSizes(layout) { const {rows, scale} = layout; for (let i = 0; i < rows.length; i++) { @@ -223,7 +205,7 @@ class UnalignedLayoutStrategy extends LayoutStrategy { let totalWidth = 0; for (let i = 0; i < windows.length; i++) { const window = windows[i]; - const s = this._computeWindowScale(window); + const s = this.computeWindowScale(window); totalWidth += window.boundingBox.width * s; } @@ -241,7 +223,7 @@ class UnalignedLayoutStrategy extends LayoutStrategy { for (; windowIdx < sortedWindows.length; windowIdx++) { const window = sortedWindows[windowIdx]; - const s = this._computeWindowScale(window); + const s = this.computeWindowScale(window); const width = window.boundingBox.width * s; const height = window.boundingBox.height * s; row.fullHeight = Math.max(row.fullHeight, height); @@ -299,6 +281,24 @@ class UnalignedLayoutStrategy extends LayoutStrategy { return [scale, space]; } + // Computes and returns an individual scaling factor for @window, + // to be applied in addition to the overall layout scale. + computeWindowScale(window) { + // Since we align windows next to each other, the height of the + // thumbnails is much more important to preserve than the width of + // them, so two windows with equal height, but maybe differering + // widths line up. + const ratio = window.boundingBox.height / this._monitor.height; + + // The purpose of this manipulation here is to prevent windows + // from getting too small. For something like a calculator window, + // we need to bump up the size just a bit to make sure it looks + // good. We'll use a multiplier of 1.5 for this. + + // Map from [0, 1] to [1.5, WINDOW_PREVIEW_MAXIMUM_SCALE] + return Util.lerp(1.5, WINDOW_PREVIEW_MAXIMUM_SCALE, ratio); + } + computeWindowSlots(layout, area) { this._computeRowSizes(layout); @@ -356,7 +356,7 @@ class UnalignedLayoutStrategy extends LayoutStrategy { for (let j = 0; j < row.windows.length; j++) { const window = row.windows[j]; - let s = scale * this._computeWindowScale(window) * row.additionalScale; + let s = scale * this.computeWindowScale(window) * row.additionalScale; const cellWidth = window.boundingBox.width * s; const cellHeight = window.boundingBox.height * s; @@ -723,9 +723,21 @@ export const WorkspaceLayout = GObject.registerClass({ // We only want to apply this when the scaled floating size is // actually larger than the target layout size, that is while // animating between the session and the window picker. - if (inSessionTransition) { - workspaceBoxWidth = Math.max(workspaceBoxWidth, width); - workspaceBoxHeight = Math.max(workspaceBoxHeight, height); + if (inSessionTransition && stateAdjustementValue > 0) { + const scale = Math.min( + this._layoutStrategy.computeWindowScale(child), WINDOW_PREVIEW_MAXIMUM_SCALE); + + const finalWidth = child.boundingBox.width * scale; + const finalHeight = child.boundingBox.height * scale; + + const currentWidth = Util.lerp(child.boundingBox.width, finalWidth, stateAdjustementValue); + const currentHeight = Util.lerp(child.boundingBox.height, finalHeight, stateAdjustementValue); + + workspaceBoxX += (workspaceBoxWidth - currentWidth) / 2; + workspaceBoxY += (workspaceBoxHeight - currentHeight) / 2; + + workspaceBoxWidth = currentWidth; + workspaceBoxHeight = currentHeight; } x = Util.lerp(workspaceBoxX, x, stateAdjustementValue); @@ -1297,7 +1309,6 @@ class Workspace extends St.Widget { this._layoutFrozenId = 0; } - this._container.layout_manager.layout_frozen = true; Main.overview.connectObject( 'hidden', this._doneLeavingOverview.bind(this), this); }