mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Merge branch 'pr/110059'
This commit is contained in:
commit
f240d05f0c
|
@ -52,6 +52,8 @@ export interface IListViewOptionsUpdate {
|
|||
readonly additionalScrollHeight?: number;
|
||||
readonly smoothScrolling?: boolean;
|
||||
readonly horizontalScrolling?: boolean;
|
||||
readonly mouseWheelScrollSensitivity?: number;
|
||||
readonly fastScrollSensitivity?: number;
|
||||
}
|
||||
|
||||
export interface IListViewOptions<T> extends IListViewOptionsUpdate {
|
||||
|
@ -333,6 +335,8 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||
horizontal: ScrollbarVisibility.Auto,
|
||||
vertical: getOrDefault(options, o => o.verticalScrollMode, DefaultOptions.verticalScrollMode),
|
||||
useShadows: getOrDefault(options, o => o.useShadows, DefaultOptions.useShadows),
|
||||
mouseWheelScrollSensitivity: options.mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: options.fastScrollSensitivity
|
||||
}, this.scrollable));
|
||||
|
||||
this.domNode.appendChild(this.scrollableElement.getDomNode());
|
||||
|
@ -371,6 +375,14 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||
if (options.horizontalScrolling !== undefined) {
|
||||
this.horizontalScrolling = options.horizontalScrolling;
|
||||
}
|
||||
|
||||
if (options.mouseWheelScrollSensitivity !== undefined) {
|
||||
this.scrollableElement.updateOptions({ mouseWheelScrollSensitivity: options.mouseWheelScrollSensitivity });
|
||||
}
|
||||
|
||||
if (options.fastScrollSensitivity !== undefined) {
|
||||
this.scrollableElement.updateOptions({ fastScrollSensitivity: options.fastScrollSensitivity });
|
||||
}
|
||||
}
|
||||
|
||||
triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import { IDragAndDropData } from 'vs/base/browser/dnd';
|
|||
import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { IThemable } from 'vs/base/common/styler';
|
||||
import { createStyleSheet } from 'vs/base/browser/dom';
|
||||
import { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
interface ITraitChangeEvent {
|
||||
|
@ -917,6 +918,7 @@ export interface IListOptions<T> extends IListOptionsUpdate {
|
|||
readonly additionalScrollHeight?: number;
|
||||
readonly transformOptimization?: boolean;
|
||||
readonly smoothScrolling?: boolean;
|
||||
readonly scrollableElementChangeOptions?: ScrollableElementChangeOptions;
|
||||
readonly alwaysConsumeMouseWheel?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -964,6 +964,8 @@ export interface IAbstractTreeOptionsUpdate extends ITreeRendererOptions {
|
|||
readonly filterOnType?: boolean;
|
||||
readonly smoothScrolling?: boolean;
|
||||
readonly horizontalScrolling?: boolean;
|
||||
readonly mouseWheelScrollSensitivity?: number;
|
||||
readonly fastScrollSensitivity?: number;
|
||||
readonly expandOnDoubleClick?: boolean;
|
||||
readonly expandOnlyOnTwistieClick?: boolean | ((e: any) => boolean); // e is T
|
||||
}
|
||||
|
|
|
@ -126,6 +126,8 @@ const automaticKeyboardNavigationSettingKey = 'workbench.list.automaticKeyboardN
|
|||
const treeIndentKey = 'workbench.tree.indent';
|
||||
const treeRenderIndentGuidesKey = 'workbench.tree.renderIndentGuides';
|
||||
const listSmoothScrolling = 'workbench.list.smoothScrolling';
|
||||
const mouseWheelScrollSensitivityKey = 'workbench.list.mouseWheelScrollSensitivity';
|
||||
const fastScrollSensitivityKey = 'workbench.list.fastScrollSensitivity';
|
||||
const treeExpandMode = 'workbench.tree.expandMode';
|
||||
|
||||
function useAltAsMultipleSelectionModifier(configurationService: IConfigurationService): boolean {
|
||||
|
@ -166,22 +168,15 @@ class MultipleSelectionController<T> extends Disposable implements IMultipleSele
|
|||
|
||||
function toWorkbenchListOptions<T>(options: IListOptions<T>, configurationService: IConfigurationService, keybindingService: IKeybindingService): [IListOptions<T>, IDisposable] {
|
||||
const disposables = new DisposableStore();
|
||||
const result = { ...options };
|
||||
|
||||
if (!options.multipleSelectionController) {
|
||||
const multipleSelectionController = new MultipleSelectionController(configurationService);
|
||||
result.multipleSelectionController = multipleSelectionController;
|
||||
disposables.add(multipleSelectionController);
|
||||
}
|
||||
|
||||
result.keyboardNavigationDelegate = {
|
||||
mightProducePrintableCharacter(e) {
|
||||
return keybindingService.mightProducePrintableCharacter(e);
|
||||
}
|
||||
const result: IListOptions<T> = {
|
||||
...options,
|
||||
keyboardNavigationDelegate: { mightProducePrintableCharacter(e) { return keybindingService.mightProducePrintableCharacter(e); } },
|
||||
smoothScrolling: Boolean(configurationService.getValue(listSmoothScrolling)),
|
||||
mouseWheelScrollSensitivity: configurationService.getValue<number>(mouseWheelScrollSensitivityKey),
|
||||
fastScrollSensitivity: configurationService.getValue<number>(fastScrollSensitivityKey),
|
||||
multipleSelectionController: options.multipleSelectionController ?? disposables.add(new MultipleSelectionController(configurationService))
|
||||
};
|
||||
|
||||
result.smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
|
||||
|
||||
return [result, disposables];
|
||||
}
|
||||
|
||||
|
@ -287,6 +282,14 @@ export class WorkbenchList<T> extends List<T> {
|
|||
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
|
||||
options = { ...options, smoothScrolling };
|
||||
}
|
||||
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
|
||||
const mouseWheelScrollSensitivity = configurationService.getValue<number>(mouseWheelScrollSensitivityKey);
|
||||
options = { ...options, mouseWheelScrollSensitivity };
|
||||
}
|
||||
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
|
||||
const fastScrollSensitivity = configurationService.getValue<number>(fastScrollSensitivityKey);
|
||||
options = { ...options, fastScrollSensitivity };
|
||||
}
|
||||
if (Object.keys(options).length > 0) {
|
||||
this.updateOptions(options);
|
||||
}
|
||||
|
@ -404,6 +407,14 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
|||
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
|
||||
options = { ...options, smoothScrolling };
|
||||
}
|
||||
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
|
||||
const mouseWheelScrollSensitivity = configurationService.getValue<number>(mouseWheelScrollSensitivityKey);
|
||||
options = { ...options, mouseWheelScrollSensitivity };
|
||||
}
|
||||
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
|
||||
const fastScrollSensitivity = configurationService.getValue<number>(fastScrollSensitivityKey);
|
||||
options = { ...options, fastScrollSensitivity };
|
||||
}
|
||||
if (Object.keys(options).length > 0) {
|
||||
this.updateOptions(options);
|
||||
}
|
||||
|
@ -546,6 +557,14 @@ export class WorkbenchTable<TRow> extends Table<TRow> {
|
|||
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
|
||||
options = { ...options, smoothScrolling };
|
||||
}
|
||||
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
|
||||
const mouseWheelScrollSensitivity = configurationService.getValue<number>(mouseWheelScrollSensitivityKey);
|
||||
options = { ...options, mouseWheelScrollSensitivity };
|
||||
}
|
||||
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
|
||||
const fastScrollSensitivity = configurationService.getValue<number>(fastScrollSensitivityKey);
|
||||
options = { ...options, fastScrollSensitivity };
|
||||
}
|
||||
if (Object.keys(options).length > 0) {
|
||||
this.updateOptions(options);
|
||||
}
|
||||
|
@ -1133,7 +1152,7 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
|
|||
this.hasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
|
||||
}),
|
||||
configurationService.onDidChangeConfiguration(e => {
|
||||
let newOptions: any = {};
|
||||
let newOptions: IAbstractTreeOptionsUpdate = {};
|
||||
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
|
||||
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
|
||||
}
|
||||
|
@ -1162,6 +1181,14 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
|
|||
if (e.affectsConfiguration(treeExpandMode) && options.expandOnlyOnTwistieClick === undefined) {
|
||||
newOptions = { ...newOptions, expandOnlyOnTwistieClick: configurationService.getValue<'singleClick' | 'doubleClick'>(treeExpandMode) === 'doubleClick' };
|
||||
}
|
||||
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
|
||||
const mouseWheelScrollSensitivity = configurationService.getValue<number>(mouseWheelScrollSensitivityKey);
|
||||
newOptions = { ...newOptions, mouseWheelScrollSensitivity };
|
||||
}
|
||||
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
|
||||
const fastScrollSensitivity = configurationService.getValue<number>(fastScrollSensitivityKey);
|
||||
newOptions = { ...newOptions, fastScrollSensitivity };
|
||||
}
|
||||
if (Object.keys(newOptions).length > 0) {
|
||||
tree.updateOptions(newOptions);
|
||||
}
|
||||
|
@ -1256,6 +1283,16 @@ configurationRegistry.registerConfiguration({
|
|||
default: false,
|
||||
description: localize('list smoothScrolling setting', "Controls whether lists and trees have smooth scrolling."),
|
||||
},
|
||||
[mouseWheelScrollSensitivityKey]: {
|
||||
type: 'number',
|
||||
default: 1,
|
||||
description: localize('Mouse Wheel Scroll Sensitivity', "A multiplier to be used on the deltaX and deltaY of mouse wheel scroll events.")
|
||||
},
|
||||
[fastScrollSensitivityKey]: {
|
||||
type: 'number',
|
||||
default: 5,
|
||||
description: localize('Fast Scroll Sensitivity', "Scrolling speed multiplier when pressing Alt.")
|
||||
},
|
||||
[keyboardNavigationSettingKey]: {
|
||||
type: 'string',
|
||||
enum: ['simple', 'highlight', 'filter'],
|
||||
|
|
Loading…
Reference in a new issue