Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/browser/parts/mobile/mobileLayout.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 { IWorkbenchLayoutService } from '../../../../workbench/services/layout/browser/layoutService.js';
7
8
/**
9
* CSS class applied to the sessions workbench main container when the
10
* viewport is classified as phone. Must stay in sync with
11
* `LayoutClasses.PHONE_LAYOUT` in `workbench.ts`.
12
*/
13
const PHONE_LAYOUT_CLASS = 'phone-layout';
14
15
/**
16
* Returns true when the sessions workbench currently has the phone
17
* layout class on its main container.
18
*
19
* Mobile Part subclasses are chosen once at construction time, but the
20
* viewport class can change at runtime (e.g., device rotation crossing
21
* the phone breakpoint). Parts use this to decide whether to apply
22
* mobile-specific layout math or defer to the desktop implementation.
23
*/
24
export function isPhoneLayout(layoutService: IWorkbenchLayoutService): boolean {
25
return layoutService.mainContainer.classList.contains(PHONE_LAYOUT_CLASS);
26
}
27
28