44 * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License }
55 */
66
7- var VisualBounds = require ( './VisualBounds' ) ;
8-
9- var GetScreenOrientation = function ( primaryFallback )
7+ var GetScreenOrientation = function ( width , height )
108{
119 var screen = window . screen ;
12- var orientation = screen . orientation || screen . mozOrientation || screen . msOrientation ;
10+ var orientation = ( screen ) ? screen . orientation || screen . mozOrientation || screen . msOrientation : false ;
1311
1412 if ( orientation && typeof orientation . type === 'string' )
1513 {
@@ -25,15 +23,11 @@ var GetScreenOrientation = function (primaryFallback)
2523 var PORTRAIT = 'portrait-primary' ;
2624 var LANDSCAPE = 'landscape-primary' ;
2725
28- if ( primaryFallback === ' screen' )
26+ if ( screen )
2927 {
3028 return ( screen . height > screen . width ) ? PORTRAIT : LANDSCAPE ;
3129 }
32- else if ( primaryFallback === 'viewport' )
33- {
34- return ( VisualBounds . height > VisualBounds . width ) ? PORTRAIT : LANDSCAPE ;
35- }
36- else if ( primaryFallback === 'window.orientation' && typeof window . orientation === 'number' )
30+ else if ( typeof window . orientation === 'number' )
3731 {
3832 // This may change by device based on "natural" orientation.
3933 return ( window . orientation === 0 || window . orientation === 180 ) ? PORTRAIT : LANDSCAPE ;
@@ -49,8 +43,8 @@ var GetScreenOrientation = function (primaryFallback)
4943 return LANDSCAPE ;
5044 }
5145 }
52-
53- return ( VisualBounds . height > VisualBounds . width ) ? PORTRAIT : LANDSCAPE ;
46+
47+ return ( height > width ) ? PORTRAIT : LANDSCAPE ;
5448} ;
5549
5650module . exports = GetScreenOrientation ;
0 commit comments