mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
parent
10fc457d69
commit
244428dfa7
|
@ -81,6 +81,13 @@ export function setGlobalSashSize(size: number): void {
|
|||
onDidChangeGlobalSize.fire(size);
|
||||
}
|
||||
|
||||
let globalHoverDelay = 300;
|
||||
const onDidChangeHoverDelay = new Emitter<number>();
|
||||
export function setGlobalHoverDelay(size: number): void {
|
||||
globalHoverDelay = size;
|
||||
onDidChangeHoverDelay.fire(size);
|
||||
}
|
||||
|
||||
export class Sash extends Disposable {
|
||||
|
||||
private el: HTMLElement;
|
||||
|
@ -88,7 +95,8 @@ export class Sash extends Disposable {
|
|||
private hidden: boolean;
|
||||
private orientation!: Orientation;
|
||||
private size: number;
|
||||
private hoverDelayer = this._register(new Delayer(300));
|
||||
private hoverDelay = globalHoverDelay;
|
||||
private hoverDelayer = this._register(new Delayer(this.hoverDelay));
|
||||
|
||||
private _state: SashState = SashState.Enabled;
|
||||
get state(): SashState { return this._state; }
|
||||
|
@ -221,6 +229,8 @@ export class Sash extends Disposable {
|
|||
}));
|
||||
}
|
||||
|
||||
this._register(onDidChangeHoverDelay.event(delay => this.hoverDelay = delay));
|
||||
|
||||
this.hidden = false;
|
||||
this.layoutProvider = layoutProvider;
|
||||
|
||||
|
@ -403,7 +413,7 @@ export class Sash extends Disposable {
|
|||
sash.hoverDelayer.cancel();
|
||||
sash.el.classList.add('hover');
|
||||
} else {
|
||||
sash.hoverDelayer.trigger(() => sash.el.classList.add('hover')).then(undefined, () => { });
|
||||
sash.hoverDelayer.trigger(() => sash.el.classList.add('hover'), sash.hoverDelay).then(undefined, () => { });
|
||||
}
|
||||
|
||||
if (!fromLinkedSash && sash.linkedSash) {
|
||||
|
|
|
@ -30,6 +30,13 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|||
maximum: maxSize,
|
||||
description: localize('sashSize', "Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it's hard to resize views using the mouse.")
|
||||
},
|
||||
'workbench.sash.hoverDelay': {
|
||||
type: 'number',
|
||||
default: 300,
|
||||
minimum: 0,
|
||||
maximum: 2000,
|
||||
description: localize('sashHoverDelay', "Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.")
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { clamp } from 'vs/base/common/numbers';
|
||||
import { setGlobalSashSize } from 'vs/base/browser/ui/sash/sash';
|
||||
import { setGlobalSashSize, setGlobalHoverDelay } from 'vs/base/browser/ui/sash/sash';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
@ -20,17 +20,25 @@ export class SashSettingsController implements IWorkbenchContribution, IDisposab
|
|||
constructor(
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) {
|
||||
const onDidChangeSizeConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('workbench.sash.size'));
|
||||
onDidChangeSizeConfiguration(this.onDidChangeSizeConfiguration, this, this.disposables);
|
||||
this.onDidChangeSizeConfiguration();
|
||||
const onDidChangeSize = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('workbench.sash.size'));
|
||||
onDidChangeSize(this.onDidChangeSize, this, this.disposables);
|
||||
this.onDidChangeSize();
|
||||
|
||||
const onDidChangeHoverDelay = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('workbench.sash.hoverDelay'));
|
||||
onDidChangeHoverDelay(this.onDidChangeHoverDelay, this, this.disposables);
|
||||
this.onDidChangeHoverDelay();
|
||||
}
|
||||
|
||||
private onDidChangeSizeConfiguration(): void {
|
||||
private onDidChangeSize(): void {
|
||||
const size = clamp(this.configurationService.getValue<number>('workbench.sash.size') ?? minSize, minSize, maxSize);
|
||||
document.documentElement.style.setProperty('--sash-size', size + 'px');
|
||||
setGlobalSashSize(size);
|
||||
}
|
||||
|
||||
private onDidChangeHoverDelay(): void {
|
||||
setGlobalHoverDelay(this.configurationService.getValue<number>('workbench.sash.hoverDelay'));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables.dispose();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue