From e9adab01141a3d0f9fe8fc29cb1bbbc64be752f1 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 10 Jan 2017 11:20:20 -0500 Subject: [PATCH] fix(platform): only set isPortrait when the width/height is set --- src/platform/platform.ts | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/platform/platform.ts b/src/platform/platform.ts index 2ec57d235f9..fa2825f5f1e 100644 --- a/src/platform/platform.ts +++ b/src/platform/platform.ts @@ -569,24 +569,30 @@ export class Platform { // we're keeping track of portrait and landscape dimensions // separately because the virtual keyboard can really mess - // up accurate values when the keyboard up - if (win.screen.width < win.screen.height) { - this._isPortrait = true; - if (this._pW < win['innerWidth']) { - this._pW = win['innerWidth']; - } - if (this._pH < win['innerHeight']) { - this._pH = win['innerHeight']; - } + // up accurate values when the keyboard is up + if (win.screen.width > 0 && win.screen.height > 0) { + if (win.screen.width < win.screen.height) { - } else { - this._isPortrait = false; - if (this._lW < win['innerWidth']) { - this._lW = win['innerWidth']; - } - if (this._lH < win['innerHeight']) { - this._lH = win['innerHeight']; + if (this._pW < win['innerWidth']) { + this._isPortrait = true; + this._pW = win['innerWidth']; + } + if (this._pH < win['innerHeight']) { + this._isPortrait = true; + this._pH = win['innerHeight']; + } + + } else { + if (this._lW < win['innerWidth']) { + this._isPortrait = false; + this._lW = win['innerWidth']; + } + if (this._lH < win['innerHeight']) { + this._isPortrait = false; + this._lH = win['innerHeight']; + } } + } } }