File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License }
55 */
66
7+ var CONST = require ( './const' ) ;
8+
79var GetScreenOrientation = function ( width , height )
810{
911 var screen = window . screen ;
@@ -19,32 +21,29 @@ var GetScreenOrientation = function (width, height)
1921 // moz / ms-orientation are strings
2022 return orientation ;
2123 }
22-
23- var PORTRAIT = 'portrait-primary' ;
24- var LANDSCAPE = 'landscape-primary' ;
25-
24+
2625 if ( screen )
2726 {
28- return ( screen . height > screen . width ) ? PORTRAIT : LANDSCAPE ;
27+ return ( screen . height > screen . width ) ? CONST . PORTRAIT : CONST . LANDSCAPE ;
2928 }
3029 else if ( typeof window . orientation === 'number' )
3130 {
3231 // This may change by device based on "natural" orientation.
33- return ( window . orientation === 0 || window . orientation === 180 ) ? PORTRAIT : LANDSCAPE ;
32+ return ( window . orientation === 0 || window . orientation === 180 ) ? CONST . PORTRAIT : CONST . LANDSCAPE ;
3433 }
3534 else if ( window . matchMedia )
3635 {
3736 if ( window . matchMedia ( '(orientation: portrait)' ) . matches )
3837 {
39- return PORTRAIT ;
38+ return CONST . PORTRAIT ;
4039 }
4140 else if ( window . matchMedia ( '(orientation: landscape)' ) . matches )
4241 {
43- return LANDSCAPE ;
42+ return CONST . LANDSCAPE ;
4443 }
4544 }
4645
47- return ( height > width ) ? PORTRAIT : LANDSCAPE ;
46+ return ( height > width ) ? CONST . PORTRAIT : CONST . LANDSCAPE ;
4847} ;
4948
5049module . exports = GetScreenOrientation ;
You can’t perform that action at this time.
0 commit comments