Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/browser/parts/mobile/mobilePanelPart.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Parts } from '../../../../workbench/services/layout/browser/layoutService.js';
7
import { AbstractPaneCompositePart } from '../../../../workbench/browser/parts/paneCompositePart.js';
8
import { PanelPart } from '../panelPart.js';
9
import { isPhoneLayout } from './mobileLayout.js';
10
11
/**
12
* Mobile variant of PanelPart.
13
*
14
* On phone-sized viewports the panel fills the full grid cell
15
* without card margins or border insets. On tablet/desktop it falls
16
* back to the desktop behavior so runtime viewport transitions keep
17
* working.
18
*/
19
export class MobilePanelPart extends PanelPart {
20
21
override updateStyles(): void {
22
super.updateStyles();
23
24
if (!isPhoneLayout(this.layoutService)) {
25
return;
26
}
27
28
const container = this.getContainer();
29
if (container) {
30
container.style.backgroundColor = '';
31
container.style.removeProperty('--part-background');
32
container.style.removeProperty('--part-border-color');
33
}
34
}
35
36
override layout(width: number, height: number, top: number, left: number): void {
37
if (!isPhoneLayout(this.layoutService)) {
38
super.layout(width, height, top, left);
39
return;
40
}
41
42
if (!this.layoutService.isVisible(Parts.PANEL_PART)) {
43
return;
44
}
45
46
// Full dimensions — no card margins or border subtraction.
47
// AbstractPaneCompositePart.layout internally calls Part.layout.
48
AbstractPaneCompositePart.prototype.layout.call(this, width, height, top, left);
49
}
50
}
51
52