Browse Source

Pull request #34: BI-65346 fix: 处理scale元素的滚动问题

Merge in PG2/plugin-bi-screen-adaptive from ~FAY/plugin-bi-screen-adaptive:release/10.0 to release/10.0

* commit 'd650aeef5a754696a7c2cc586fc0290748819579':
  BI-65346 fix: 处理scale元素的滚动问题
release/10.0
fay 5 years ago
parent
commit
1adef9de69
  1. 20
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  2. 20
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

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

@ -2,12 +2,15 @@
var scale = 1, transformY = 0, selected = true;
var html = document.getElementsByTagName('html')[0];
var wrapper = document.getElementById("wrapper");
var fixedWrapper = document.createElement("div");
var fixedContainer = document.createElement('div');
fixedContainer.style.position = "absolute";
fixedContainer.style.top = "0";
fixedContainer.style.left = "0";
fixedContainer.style.width = "100%";
document.body.appendChild(fixedWrapper);
fixedWrapper.appendChild(wrapper);
wrapper.appendChild(fixedContainer);
var jQuery = $ || window.jQuery;
@ -60,14 +63,15 @@
wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
wrapper.style["-ms-transform-origin"] = "top left";
fixedContainer.style.height = (document.body.clientHeight / scale) + "px";
wrapper.style.overflowY = "hidden";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "auto";
wrapper.style.overflowY = "auto";
html.style.backgroundColor = "#ffffff";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "auto";
fixedWrapper.style.overflow = "hidden";
if (scale < 1) {
document.body.style.width = bounds.width + "px";
document.body.style.height = bounds.height + "px";
fixedWrapper.style.width = bounds.width * scale + "px";
fixedWrapper.style.height = bounds.height * scale + "px";
}
window.scale = window.devicePixelRatio * scale;
@ -84,12 +88,14 @@
wrapper.style.overflowY = "hidden";
wrapper.style.top = "";
fixedContainer.style.height = "0px";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "hidden";
html.style.backgroundColor = "#ffffff";
document.body.style.overflow = "hidden";
document.body.style.width = "100%";
document.body.style.height = "100%";
fixedWrapper.style.overflow = "hidden";
fixedWrapper.style.width = "100%";
fixedWrapper.style.height = "100%";
scale = 1;
window.scale = window.devicePixelRatio / scale;

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

@ -2,12 +2,15 @@
var scale = 1, transformY = 0, selected = true;
var html = document.getElementsByTagName('html')[0];
var wrapper = document.getElementById("wrapper");
var fixedWrapper = document.createElement("div");
var fixedContainer = document.createElement('div');
fixedContainer.style.position = "absolute";
fixedContainer.style.top = "0";
fixedContainer.style.left = "0";
fixedContainer.style.width = "100%";
document.body.appendChild(fixedWrapper);
fixedWrapper.appendChild(wrapper);
wrapper.appendChild(fixedContainer);
var jQuery = $ || window.jQuery;
@ -60,14 +63,15 @@
wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
wrapper.style["-ms-transform-origin"] = "top left";
fixedContainer.style.height = (document.body.clientHeight / scale) + "px";
wrapper.style.overflowY = "hidden";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "auto";
wrapper.style.overflowY = "auto";
html.style.backgroundColor = "#ffffff";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "auto";
fixedWrapper.style.overflow = "hidden";
if (scale < 1) {
document.body.style.width = bounds.width + "px";
document.body.style.height = bounds.height + "px";
fixedWrapper.style.width = bounds.width * scale + "px";
fixedWrapper.style.height = bounds.height * scale + "px";
}
window.scale = window.devicePixelRatio * scale;
@ -84,12 +88,14 @@
wrapper.style.overflowY = "hidden";
wrapper.style.top = "";
fixedContainer.style.height = "0px";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "hidden";
html.style.backgroundColor = "#ffffff";
document.body.style.overflow = "hidden";
document.body.style.width = "100%";
document.body.style.height = "100%";
fixedWrapper.style.overflow = "hidden";
fixedWrapper.style.width = "100%";
fixedWrapper.style.height = "100%";
scale = 1;
window.scale = window.devicePixelRatio / scale;

Loading…
Cancel
Save