|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
| 6 | +import { clamp } from 'vs/base/common/numbers'; |
6 | 7 | import { createStyleSheet } from 'vs/base/browser/dom'; |
7 | 8 | import { setGlobalSashSize } from 'vs/base/browser/ui/sash/sash'; |
8 | 9 | import { Event } from 'vs/base/common/event'; |
@@ -31,21 +32,19 @@ export class SashSizeController extends Disposable implements IWorkbenchContribu |
31 | 32 | } |
32 | 33 |
|
33 | 34 | 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); |
50 | 49 | } |
51 | 50 | } |
0 commit comments