mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Prevent reflow when getting screen orientation
It is better to access the device orientation using media queries as it will not force a reflow compared to accessing innerWidth/innerHeight
This commit is contained in:
parent
7123abc122
commit
525e3eaf43
@ -684,7 +684,9 @@ export default class CountlyAnalytics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getOrientation = (): Orientation => {
|
private getOrientation = (): Orientation => {
|
||||||
return window.innerWidth > window.innerHeight ? Orientation.Landscape : Orientation.Portrait;
|
return window.matchMedia("(orientation: landscape)").matches
|
||||||
|
? Orientation.Landscape
|
||||||
|
: Orientation.Portrait
|
||||||
};
|
};
|
||||||
|
|
||||||
private reportOrientation = () => {
|
private reportOrientation = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user