Skip to content

Commit 21342dc

Browse files
committed
Now uses consts
1 parent ab3d8aa commit 21342dc

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

src/dom/GetScreenOrientation.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
var CONST = require('./const');
8+
79
var 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

5049
module.exports = GetScreenOrientation;

0 commit comments

Comments
 (0)