From 48248fac233e18ead863c8784a5fee4acfe674d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Wed, 1 Apr 2020 12:37:52 +0200 Subject: [PATCH] fixes #93344 --- .../browser/parts/views/media/views.css | 10 ++++++++- .../browser/parts/views/viewPaneContainer.ts | 22 +++++++++++++++++-- .../contrib/files/browser/views/emptyView.ts | 4 ---- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/views/media/views.css b/src/vs/workbench/browser/parts/views/media/views.css index a9986e61e34..ce5f3056e3b 100644 --- a/src/vs/workbench/browser/parts/views/media/views.css +++ b/src/vs/workbench/browser/parts/views/media/views.css @@ -52,7 +52,6 @@ .monaco-workbench .pane > .pane-body > .welcome-view { width: 100%; height: 100%; - padding: 0 20px 0 20px; box-sizing: border-box; display: flex; flex-direction: column; @@ -70,6 +69,15 @@ display: block; } +.monaco-workbench .pane > .pane-body .welcome-view-content { + padding: 0 20px 0 20px; + box-sizing: border-box; +} + +.monaco-workbench .pane > .pane-body .welcome-view-content > *:last-child { + margin-bottom: 1em; +} + .customview-tree .monaco-list-row .monaco-tl-contents.align-icon-with-twisty::before { display: none; } diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts index 761e1d095f3..c361f820ed4 100644 --- a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -47,6 +47,8 @@ import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar'; import { CompositeProgressIndicator } from 'vs/workbench/services/progress/browser/progressIndicator'; import { IProgressIndicator } from 'vs/platform/progress/common/progress'; import { RunOnceScheduler } from 'vs/base/common/async'; +import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; +import { ScrollbarVisibility } from 'vs/base/common/scrollable'; export interface IPaneColors extends IColorMapping { dropBackground?: ColorIdentifier; @@ -309,9 +311,20 @@ export abstract class ViewPane extends Pane implements IView { this._onDidChangeTitleArea.fire(); } + private scrollableElement!: DomScrollableElement; + protected renderBody(container: HTMLElement): void { this.bodyContainer = container; - this.viewWelcomeContainer = append(container, $('.welcome-view', { tabIndex: 0 })); + + const viewWelcomeContainer = append(container, $('.welcome-view')); + this.viewWelcomeContainer = $('.welcome-view-content', { tabIndex: 0 }); + this.scrollableElement = this._register(new DomScrollableElement(this.viewWelcomeContainer, { + alwaysConsumeMouseWheel: true, + horizontal: ScrollbarVisibility.Hidden, + vertical: ScrollbarVisibility.Visible, + })); + + append(viewWelcomeContainer, this.scrollableElement.getDomNode()); const onViewWelcomeChange = Event.any(this.viewWelcomeController.onDidChange, this.onDidChangeViewWelcomeState); this._register(onViewWelcomeChange(this.updateViewWelcome, this)); @@ -319,7 +332,9 @@ export abstract class ViewPane extends Pane implements IView { } protected layoutBody(height: number, width: number): void { - // noop + this.viewWelcomeContainer.style.height = `${height}px`; + this.viewWelcomeContainer.style.width = `${width}px`; + this.scrollableElement.scanDomNode(); } getProgressIndicator() { @@ -410,6 +425,7 @@ export abstract class ViewPane extends Pane implements IView { if (!this.shouldShowWelcome()) { removeClass(this.bodyContainer, 'welcome'); this.viewWelcomeContainer.innerHTML = ''; + this.scrollableElement.scanDomNode(); return; } @@ -418,6 +434,7 @@ export abstract class ViewPane extends Pane implements IView { if (contents.length === 0) { removeClass(this.bodyContainer, 'welcome'); this.viewWelcomeContainer.innerHTML = ''; + this.scrollableElement.scanDomNode(); return; } @@ -482,6 +499,7 @@ export abstract class ViewPane extends Pane implements IView { } } + this.scrollableElement.scanDomNode(); this.viewWelcomeDisposable = disposables; } diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index 042b938fef1..9cfc00be3ae 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -89,8 +89,4 @@ export class EmptyView extends ViewPane { this.updateTitle(this.title); } } - - layoutBody(_size: number): void { - // no-op - } }