Browse Source

Merge pull request #3 in PG/plugin-bi-screen-adaptive from ~FAY/plugin-bi-screen-adaptive:release/10.0 to release/10.0

* commit '6523685b4ccf6851db9abfaf27e62a03f601126a':
  BI-48301 & BI-48300
  BI-48301 & BI-48300 & BI-48309:修复部分问题
feature/10.0
fay 5 years ago
parent
commit
81fb21434b
  1. 14
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  2. 14
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

14
src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js

@ -30,7 +30,7 @@
document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
document.body.style["-ms-transform-origin"] = "top left";
html.style.overflowY = "auto";
html.style.backgroundColor = "#2c3d59";
html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff";
if (bounds.height * bounds.scale < html.clientHeight) {
transformY = (html.clientHeight - bounds.height * bounds.scale) / 2;
@ -56,8 +56,8 @@
document.body.style.top = "0px";
html.style.backgroundColor = "#ffffff";
window.scale = window.devicePixelRatio / scale;
scale = 1;
window.scale = window.devicePixelRatio / scale;
}
// 获取缩放倍数,原模板宽高
@ -83,13 +83,13 @@
}
});
var templateWidth = Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)));
var templateHeight = Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)));
var templateWidth = (Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)))) + 60;
var templateHeight = (Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)))) + 30;
var scaleRatio = parseFloat((html.clientWidth / templateWidth).toFixed(1));
return {
scale: scaleRatio,
width: html.clientWidth / scaleRatio,
height: templateHeight
height: scaleRatio === 1 ? html.clientHeight : templateHeight
};
}
@ -167,6 +167,8 @@
}
window.addEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').
addListener(selectHandler);
}
function restoreEnv() {
@ -177,6 +179,8 @@
}
window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').
removeListener(selectHandler);
}
function selectHandler () {

14
src/main/resources/com/finebi/plugin/web/scripts/entry.js

@ -30,7 +30,7 @@
document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
document.body.style["-ms-transform-origin"] = "top left";
html.style.overflowY = "auto";
html.style.backgroundColor = "#2c3d59";
html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff";
if (bounds.height * bounds.scale < html.clientHeight) {
transformY = (html.clientHeight - bounds.height * bounds.scale) / 2;
@ -56,8 +56,8 @@
document.body.style.top = "0px";
html.style.backgroundColor = "#ffffff";
window.scale = window.devicePixelRatio / scale;
scale = 1;
window.scale = window.devicePixelRatio / scale;
}
// 获取缩放倍数,原模板宽高
@ -83,13 +83,13 @@
}
});
var templateWidth = Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)));
var templateHeight = Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)));
var templateWidth = (Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)))) + 60;
var templateHeight = (Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)))) + 30;
var scaleRatio = parseFloat((html.clientWidth / templateWidth).toFixed(1));
return {
scale: scaleRatio,
width: html.clientWidth / scaleRatio,
height: templateHeight
height: scaleRatio === 1 ? html.clientHeight : templateHeight
};
}
@ -167,6 +167,8 @@
}
window.addEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').
addListener(selectHandler);
}
function restoreEnv() {
@ -177,6 +179,8 @@
}
window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').
removeListener(selectHandler);
}
function selectHandler () {

Loading…
Cancel
Save