mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 22:37:41 +00:00
Render workbench inside visual viewport.
This commit is contained in:
parent
607df9880f
commit
5d0fd48922
|
@ -477,6 +477,11 @@ export function getClientArea(element: HTMLElement): Dimension {
|
|||
return new Dimension(element.clientWidth, element.clientHeight);
|
||||
}
|
||||
|
||||
// If visual view port exits, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
|
||||
if ((<any>window).visualViewport) {
|
||||
return new Dimension((<any>window).visualViewport.width, (<any>window).visualViewport.height);
|
||||
}
|
||||
|
||||
// Try innerWidth / innerHeight
|
||||
if (window.innerWidth && window.innerHeight) {
|
||||
return new Dimension(window.innerWidth, window.innerHeight);
|
||||
|
|
|
@ -16,6 +16,15 @@
|
|||
<!-- Workbench Icon/Manifest/CSS -->
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<style>
|
||||
body.web {
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.monaco-workbench.web {
|
||||
touch-action: initial;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body aria-label="">
|
||||
|
|
|
@ -92,6 +92,10 @@ class BrowserMain extends Disposable {
|
|||
// Layout
|
||||
this._register(addDisposableListener(window, EventType.RESIZE, () => workbench.layout()));
|
||||
|
||||
if ((<any>window).visualViewport) {
|
||||
this._register(addDisposableListener((<any>window).visualViewport, EventType.RESIZE, () => workbench.layout()));
|
||||
}
|
||||
|
||||
// Prevent the back/forward gestures in macOS
|
||||
this._register(addDisposableListener(this.domElement, EventType.WHEEL, (e) => {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in a new issue