[all] fix for device scaling checking

This commit is contained in:
Maxim Kadushkin 2021-02-12 12:08:33 +03:00
parent 8dfd43ec0e
commit 3636bf78c4
4 changed files with 20 additions and 1 deletions

View file

@ -119,7 +119,23 @@ Common.Utils = _.extend(new(function() {
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
me = this,
checkSize = function() {
var scale = window.AscCommon.checkDeviceScale();
var scale = {};
if ( !!window.AscCommon )
scale = window.AscCommon.checkDeviceScale();
else {
var str_mq_150 = "screen and (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.9), " +
"screen and (min-resolution: 1.5dppx) and (max-resolution: 1.9dppx)";
var str_mq_200 = "screen and (-webkit-min-device-pixel-ratio: 2), " +
"screen and (min-resolution: 2dppx), screen and (min-resolution: 192dpi)";
if ( window.matchMedia(str_mq_150).matches ) {
scale.devicePixelRatio = 1.5;
} else
if ( window.matchMedia(str_mq_200).matches )
scale.devicePixelRatio = 2;
else scale.devicePixelRatio = 1;
}
var $root = $(document.body);
if ( scale.devicePixelRatio > 1 && scale.devicePixelRatio <= 1.5 ) {
$root.removeClass('pixel-ratio__2');

View file

@ -207,6 +207,7 @@ require([
,'common/main/lib/controller/Protection'
,'common/main/lib/controller/Themes'
,'common/main/lib/controller/Desktop'
,'../../../../sdkjs/common/device_scale.js'
], function() {
app.start();
});

View file

@ -191,6 +191,7 @@ require([
,'common/main/lib/controller/Protection'
,'common/main/lib/controller/Themes'
,'common/main/lib/controller/Desktop'
,'../../../../sdkjs/common/device_scale.js'
], function() {
app.start();
});

View file

@ -203,6 +203,7 @@ require([
,'common/main/lib/controller/Protection'
,'common/main/lib/controller/Themes'
,'common/main/lib/controller/Desktop'
,'../../../../sdkjs/common/device_scale.js'
], function() {
app.start();
});