Skip to content

Commit

Permalink
[all] fix for device scaling checking
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadushkin committed Feb 12, 2021
1 parent 8dfd43e commit 3636bf7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/common/main/lib/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions apps/documenteditor/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
1 change: 1 addition & 0 deletions apps/presentationeditor/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
1 change: 1 addition & 0 deletions apps/spreadsheeteditor/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 3636bf7

Please sign in to comment.