zomm step changed to 50%

This commit is contained in:
Maxim Kadushkin 2018-02-01 17:14:11 +03:00
parent e7d08c0e5d
commit 1497eae9d2
2 changed files with 15 additions and 17 deletions

View file

@ -108,31 +108,26 @@ 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), 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, me = this,
checkSize = function() { checkSize = function() {
me.zoom = 1; me.zoom = 1;
if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body) if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body) {
{
// делаем простую проверку // делаем простую проверку
// считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio; // считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio;
// считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio; // считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio;
if (window.devicePixelRatio > 0.1) if (window.devicePixelRatio > 0.1) {
{ var _fraction = window.devicePixelRatio % 1;
if (window.devicePixelRatio < 1.99) var _devicePixelRatio = Math.floor(window.devicePixelRatio);
{
var _devicePixelRatio = 1; if ( !(_fraction < .5) ) {
me.zoom = window.devicePixelRatio / _devicePixelRatio; _devicePixelRatio += .5;
} }
else
{ me.zoom = window.devicePixelRatio / _devicePixelRatio;
var _devicePixelRatio = 2;
me.zoom = window.devicePixelRatio / _devicePixelRatio;
}
// chrome 54.x: zoom = "reset" - clear retina zoom (windows)
//document.firstElementChild.style.zoom = "reset";
document.firstElementChild.style.zoom = 1.0 / me.zoom; document.firstElementChild.style.zoom = 1.0 / me.zoom;
} }
else else
document.firstElementChild.style.zoom = "normal"; document.firstElementChild.style.zoom = "normal";
} }
me.innerWidth = window.innerWidth * me.zoom; me.innerWidth = window.innerWidth * me.zoom;
me.innerHeight = window.innerHeight * me.zoom; me.innerHeight = window.innerHeight * me.zoom;
}; };
@ -143,6 +138,8 @@ Common.Utils = _.extend(new(function() {
$(window).on('resize', checkSize); $(window).on('resize', checkSize);
return { return {
checkSize: checkSize,
userAgent: userAgent, userAgent: userAgent,
isStrict: isStrict, isStrict: isStrict,
isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)), isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)),

View file

@ -964,6 +964,7 @@ define([
me.applyLicense(); me.applyLicense();
$(window).off('resize'); $(window).off('resize');
$(window).on('resize', Common.Utils.checkSize);
} }
}, 50); }, 50);
} else { } else {