@@ -574,40 +574,43 @@ export class Platform {
574
574
if ( this . _isPortrait === null || this . _isPortrait === false && this . _win [ 'innerWidth' ] < this . _win [ 'innerHeight' ] ) {
575
575
var win = this . _win ;
576
576
577
+ var innerWidth = win [ 'innerWidth' ] ;
578
+ var innerHeight = win [ 'innerHeight' ] ;
579
+
577
580
// we're keeping track of portrait and landscape dimensions
578
581
// separately because the virtual keyboard can really mess
579
582
// up accurate values when the keyboard is up
580
583
if ( win . screen . width > 0 && win . screen . height > 0 ) {
581
- if ( win [ ' innerWidth' ] < win [ ' innerHeight' ] ) {
584
+ if ( innerWidth < innerHeight ) {
582
585
583
586
// the device is in portrait
584
- if ( this . _pW <= win [ 'innerWidth' ] ) {
587
+ // we have to do fancier checking here
588
+ // because of the virtual keyboard resizing
589
+ // the window
590
+ if ( this . _pW <= innerWidth ) {
585
591
console . debug ( 'setting _isPortrait to true' ) ;
586
592
this . _isPortrait = true ;
587
- this . _pW = win [ ' innerWidth' ] ;
593
+ this . _pW = innerWidth ;
588
594
}
589
- if ( this . _pH <= win [ 'innerHeight' ] ) {
595
+
596
+ if ( this . _pH <= innerHeight ) {
590
597
console . debug ( 'setting _isPortrait to true' ) ;
591
598
this . _isPortrait = true ;
592
- this . _pH = win [ ' innerHeight' ] ;
599
+ this . _pH = innerHeight ;
593
600
}
594
601
595
602
} else {
596
- if ( this . _lW > win [ 'innerWidth' ] ) {
597
- // Special case: keyboard is open and device is in portrait
598
- console . debug ( 'setting _isPortrait to true while keyboard is open and device is portrait' ) ;
599
- this . _isPortrait = true ;
600
- }
601
603
// the device is in landscape
602
- if ( this . _lW <= win [ ' innerWidth' ] ) {
604
+ if ( this . _lW !== innerWidth ) {
603
605
console . debug ( 'setting _isPortrait to false' ) ;
604
606
this . _isPortrait = false ;
605
- this . _lW = win [ ' innerWidth' ] ;
607
+ this . _lW = innerWidth ;
606
608
}
607
- if ( this . _lH <= win [ 'innerHeight' ] ) {
609
+
610
+ if ( this . _lH !== innerHeight ) {
608
611
console . debug ( 'setting _isPortrait to false' ) ;
609
612
this . _isPortrait = false ;
610
- this . _lH = win [ ' innerHeight' ] ;
613
+ this . _lH = innerHeight ;
611
614
}
612
615
}
613
616
0 commit comments