MMOBILE-3833 core: Fix watchOrientation in iOS 12
parent
4ecab6d3f1
commit
1ba9f4ac8e
|
@ -121,11 +121,16 @@ export class CoreScreenService {
|
|||
*/
|
||||
watchOrientation(): void {
|
||||
// Listen media orientation CSS queries.
|
||||
window.matchMedia('(orientation: portrait)').addEventListener('change', (m) => {
|
||||
const changeListener = (m: MediaQueryListEvent) => {
|
||||
const orientation = m.matches ? CoreScreenOrientation.PORTRAIT : CoreScreenOrientation.LANDSCAPE;
|
||||
|
||||
CoreEvents.trigger(CoreEvents.ORIENTATION_CHANGE, { orientation });
|
||||
});
|
||||
};
|
||||
|
||||
const mql = window.matchMedia('(orientation: portrait)');
|
||||
mql.addEventListener ?
|
||||
mql.addEventListener('change', changeListener) :
|
||||
mql.addListener(changeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue