mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
ClientArea. use visual viewport only on mobile.
This commit is contained in:
@@ -16,6 +16,7 @@ import * as platform from 'vs/base/common/platform';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas, RemoteAuthorities } from 'vs/base/common/network';
|
||||
import { BrowserFeatures } from 'vs/base/browser/canIUse';
|
||||
|
||||
export function clearNode(node: HTMLElement): void {
|
||||
while (node.firstChild) {
|
||||
@@ -492,8 +493,8 @@ 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) {
|
||||
// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
|
||||
if (BrowserFeatures.pointerEvents && (<any>window).visualViewport) {
|
||||
return new Dimension((<any>window).visualViewport.width, (<any>window).visualViewport.height);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user