diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 5a7f4aa24..673a596fb 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -47,6 +47,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout { const workspaceBox = box.copy(); const [width, height] = workspaceBox.get_size(); const { spacing } = this; + const { expandFraction } = this._workspacesThumbnails; switch (state) { case ControlsState.HIDDEN: @@ -54,12 +55,12 @@ class ControlsManagerLayout extends Clutter.BoxLayout { case ControlsState.WINDOW_PICKER: workspaceBox.set_origin(0, searchHeight + spacing + - (thumbnailsHeight > 0 ? thumbnailsHeight + spacing : 0)); + thumbnailsHeight + spacing * expandFraction); workspaceBox.set_size(width, height - dashHeight - spacing - searchHeight - spacing - - (thumbnailsHeight > 0 ? thumbnailsHeight + spacing : 0)); + thumbnailsHeight - spacing * expandFraction); break; case ControlsState.APP_GRID: workspaceBox.set_origin(0, searchHeight + spacing); @@ -133,10 +134,11 @@ class ControlsManagerLayout extends Clutter.BoxLayout { // Workspace Thumbnails let thumbnailsHeight = 0; if (this._workspacesThumbnails.visible) { + const { expandFraction } = this._workspacesThumbnails; [thumbnailsHeight] = this._workspacesThumbnails.get_preferred_height(width); thumbnailsHeight = Math.min( - thumbnailsHeight, + thumbnailsHeight * expandFraction, height * WorkspaceThumbnail.MAX_THUMBNAIL_SCALE); childBox.set_origin(0, searchHeight + spacing); childBox.set_size(width, thumbnailsHeight); @@ -303,8 +305,15 @@ class ControlsManager extends St.Widget { this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment); - this._thumbnailsBox.connect('notify::should-show', - () => this._updateThumbnailsBox()); + this._thumbnailsBox.connect('notify::should-show', () => { + this._thumbnailsBox.show(); + this._thumbnailsBox.ease_property('expand-fraction', + this._thumbnailsBox.should_show ? 1 : 0, { + duration: SIDE_CONTROLS_ANIMATION_TIME, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => this._updateThumbnailsBox(), + }); + }); this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay( this, diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 3c9b7ed0a..e84764842 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -603,6 +603,10 @@ var WorkspaceThumbnail = GObject.registerClass({ var ThumbnailsBox = GObject.registerClass({ Properties: { + 'expand-fraction': GObject.ParamSpec.double( + 'expand-fraction', 'expand-fraction', 'expand-fraction', + GObject.ParamFlags.READWRITE, + 0, 1, 1), 'scale': GObject.ParamSpec.double( 'scale', 'scale', 'scale', GObject.ParamFlags.READWRITE, @@ -643,6 +647,7 @@ var ThumbnailsBox = GObject.registerClass({ this._targetScale = 0; this._scale = 0; + this._expandFraction = 1; this._pendingScaleUpdate = false; this._stateUpdateQueued = false; this._animatingIndicator = false; @@ -1298,8 +1303,9 @@ var ThumbnailsBox = GObject.registerClass({ } const ratio = portholeWidth / portholeHeight; - const thumbnailHeight = Math.round(portholeHeight * this._scale); - const thumbnailWidth = Math.round(thumbnailHeight * ratio); + const thumbnailFullHeight = Math.round(portholeHeight * this._scale); + const thumbnailWidth = Math.round(thumbnailFullHeight * ratio); + const thumbnailHeight = thumbnailFullHeight * this._expandFraction; const roundedVScale = thumbnailHeight / portholeHeight; // We always request size for MAX_THUMBNAIL_SCALE, distribute @@ -1422,4 +1428,16 @@ var ThumbnailsBox = GObject.registerClass({ get shouldShow() { return this._shouldShow; } + + set expandFraction(expandFraction) { + if (this._expandFraction === expandFraction) + return; + this._expandFraction = expandFraction; + this.notify('expand-fraction'); + this.queue_relayout(); + } + + get expandFraction() { + return this._expandFraction; + } });