Skip to content

Commit efb3ee7

Browse files
committed
1 parent b03d23d commit efb3ee7

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

  • src/vs/workbench/contrib/sash/browser

src/vs/workbench/contrib/sash/browser/sash.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { clamp } from 'vs/base/common/numbers';
67
import { createStyleSheet } from 'vs/base/browser/dom';
78
import { setGlobalSashSize } from 'vs/base/browser/ui/sash/sash';
89
import { Event } from 'vs/base/common/event';
@@ -31,21 +32,19 @@ export class SashSizeController extends Disposable implements IWorkbenchContribu
3132
}
3233

3334
private onDidChangeSizeConfiguration(): void {
34-
const size = this.configurationService.getValue<number>(this.configurationName);
35-
36-
if (size && size >= minSize && size <= maxSize) {
37-
// Update styles
38-
this.stylesheet.innerHTML = `
39-
.monaco-sash.vertical { cursor: ew-resize; top: 0; width: ${size}px; height: 100%; }
40-
.monaco-sash.horizontal { cursor: ns-resize; left: 0; width: 100%; height: ${size}px; }
41-
.monaco-sash:not(.disabled).orthogonal-start::before, .monaco-sash:not(.disabled).orthogonal-end::after { content: ' '; height: ${size * 2}px; width: ${size * 2}px; z-index: 100; display: block; cursor: all-scroll; position: absolute; }
42-
.monaco-sash.orthogonal-start.vertical::before { left: -${size / 2}px; top: -${size}px; }
43-
.monaco-sash.orthogonal-end.vertical::after { left: -${size / 2}px; bottom: -${size}px; }
44-
.monaco-sash.orthogonal-start.horizontal::before { top: -${size / 2}px; left: -${size}px; }
45-
.monaco-sash.orthogonal-end.horizontal::after { top: -${size / 2}px; right: -${size}px; }`;
46-
47-
// Update behavor
48-
setGlobalSashSize(size);
49-
}
35+
const size = clamp(this.configurationService.getValue<number>(this.configurationName), minSize, maxSize) ?? minSize;
36+
37+
// Update styles
38+
this.stylesheet.innerHTML = `
39+
.monaco-sash.vertical { cursor: ew-resize; top: 0; width: ${size}px; height: 100%; }
40+
.monaco-sash.horizontal { cursor: ns-resize; left: 0; width: 100%; height: ${size}px; }
41+
.monaco-sash:not(.disabled).orthogonal-start::before, .monaco-sash:not(.disabled).orthogonal-end::after { content: ' '; height: ${size * 2}px; width: ${size * 2}px; z-index: 100; display: block; cursor: all-scroll; position: absolute; }
42+
.monaco-sash.orthogonal-start.vertical::before { left: -${size / 2}px; top: -${size}px; }
43+
.monaco-sash.orthogonal-end.vertical::after { left: -${size / 2}px; bottom: -${size}px; }
44+
.monaco-sash.orthogonal-start.horizontal::before { top: -${size / 2}px; left: -${size}px; }
45+
.monaco-sash.orthogonal-end.horizontal::after { top: -${size / 2}px; right: -${size}px; }`;
46+
47+
// Update behavor
48+
setGlobalSashSize(size);
5049
}
5150
}

0 commit comments

Comments
 (0)