From a909283aa68b2c20fc7bd53d3a404f0b09bcc9fa Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 17 May 2020 08:26:49 -0400 Subject: [PATCH] Adjust scrollview size on taskbar enable --- taskbar.js | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/taskbar.js b/taskbar.js index f54b89d..4a66315 100644 --- a/taskbar.js +++ b/taskbar.js @@ -354,33 +354,13 @@ var taskbar = Utils.defineClass({ 'notify::upper', 'notify::pageSize' ], - () => { - // Update minimization animation target position on scrollview change. - this._updateAppIcons(); - - // When applications are ungrouped and there is some empty space on the horizontal taskbar, - // force a fixed label width to prevent the icons from "wiggling" when an animation runs - // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width - // to allow them to resize and make room for new icons. - if (!isVertical && !this.isGroupApps) { - let initial = this.fullScrollView; - - if (!this.fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { - this.fullScrollView = adjustment.page_size; - } else if (adjustment.page_size < this.fullScrollView) { - this.fullScrollView = 0; - } - - if (initial != this.fullScrollView) { - this._getAppIcons().forEach(a => a.updateTitleStyle()); - } - } - } + () => this._onScrollSizeChange(adjustment) ] ); this.isGroupApps = Me.settings.get_boolean('group-apps'); + this._onScrollSizeChange(adjustment); this._connectWorkspaceSignals(); }, @@ -439,6 +419,29 @@ var taskbar = Utils.defineClass({ }, + _onScrollSizeChange: function(adjustment) { + // Update minimization animation target position on scrollview change. + this._updateAppIcons(); + + // When applications are ungrouped and there is some empty space on the horizontal taskbar, + // force a fixed label width to prevent the icons from "wiggling" when an animation runs + // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width + // to allow them to resize and make room for new icons. + if (!Panel.checkIfVertical() && !this.isGroupApps) { + let initial = this.fullScrollView; + + if (!this.fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { + this.fullScrollView = adjustment.page_size; + } else if (adjustment.page_size < this.fullScrollView) { + this.fullScrollView = 0; + } + + if (initial != this.fullScrollView) { + this._getAppIcons().forEach(a => a.updateTitleStyle()); + } + } + }, + _onDragBegin: function() { this._dragCancelled = false; this._dragMonitor = {