OrientationManager manages the orientation.
There're some cases we need to reset the orientation of the top window:
- LockScreen is unlocked.
- An attention window is opened.
- All attention window is closed.
- TrustedUI is closed.
- sleepMenu is hidden.
Any of them occurs would trigger OrientationManager to dispatch
reset-orientation
event and AppWindowManager would reset the
orientation of the active window.
- Source:
Members
(private, static) _isOnRealDevice :Boolean
Record if we are on real device or not.
Record if we are on real device or not.
Type:
- Boolean
- Source:
(static) defaultOrientation :String
Default orientation of this device, possible values are:
- portrait-primary
- landscape-primary
Default orientation of this device, possible values are:
- portrait-primary
- landscape-primary
Type:
- String
- Source:
Methods
(static) fetchCurrentOrientation() → {String}
Get current orientation
.Get current orientation
- Source:
Returns:
Current orientation, possible values: portrait-primary, portrait-secondary, landscape-primary, landscape-secondary.
- Type
- String
(static) fetchDefaultOrientation()
Get the default orientation of the device when device booted.
Get the default orientation of the device when device booted.
This is a trick done by locking the orientation at first and
then get by screen.mozOrientation
.
If we are not on a real device, we will guess the orientation by the ratio of width and height of window.
- Source:
(static) isDefaultPortrait() → {Boolean}
Test if our default orientation is portrait.
Test if our default orientation is portrait.
- Source:
Returns:
If our default orientation is portrait.
- Type
- Boolean
(static) isOnRealDevice() → {Boolean}
Test if we are on real device by checking the available width.
Test if we are on real device by checking the available width.
- Source:
Returns:
If we are on real device or not.
- Type
- Boolean
Events
reset-orientation
Fired when the orientation needs to be locked/unlocked again.
Fired when the orientation needs to be locked/unlocked again.
- Source: