From d650aeef5a754696a7c2cc586fc0290748819579 Mon Sep 17 00:00:00 2001 From: fay Date: Fri, 15 May 2020 11:43:43 +0800 Subject: [PATCH] =?UTF-8?q?BI-65346=20fix:=20=E5=A4=84=E7=90=86scale?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E7=9A=84=E6=BB=9A=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/web/plugin.screen_adaptive.js | 20 ++++++++++++------- .../com/finebi/plugin/web/scripts/entry.js | 20 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js index 8b154ff..04b617d 100644 --- a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js +++ b/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; diff --git a/src/main/resources/com/finebi/plugin/web/scripts/entry.js b/src/main/resources/com/finebi/plugin/web/scripts/entry.js index 8b154ff..04b617d 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/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;