From 4412413bb37a0fe8c42eb6fb2cac5c0205c54e87 Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 18 Nov 2019 15:41:12 +0800 Subject: [PATCH] =?UTF-8?q?BI-55726=20fix=EF=BC=9A=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=B1=80=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/web/plugin.screen_adaptive.js | 19 +++++++++++++++++-- .../com/finebi/plugin/web/scripts/entry.js | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 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 daea6ac..c63e581 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 @@ -1,7 +1,14 @@ !(function () { var scale = 1, transformY = 0, selected = true; - var wrapper = document.getElementById("wrapper"); var html = document.getElementsByTagName('html')[0]; + var wrapper = document.getElementById("wrapper"); + var fixedContainer = document.createElement('div'); + fixedContainer.style.position = "absolute"; + fixedContainer.style.top = "0"; + fixedContainer.style.left = "0"; + fixedContainer.style.width = "100%"; + + wrapper.appendChild(fixedContainer); var jQuery = $ || window.jQuery; var injectOffset = jQuery.fn.offset; @@ -53,6 +60,7 @@ wrapper.style.transformOrigin = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; + fixedContainer.style.height = (document.body.clientHeight / scale) + "px"; // html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; html.style.backgroundColor = "#ffffff"; @@ -80,6 +88,7 @@ wrapper.style["-ms-transform-origin"] = ""; wrapper.style.overflowY = "hidden"; wrapper.style.top = ""; + fixedContainer.style.height = "0px"; html.style.backgroundColor = "#ffffff"; scale = 1; @@ -274,11 +283,14 @@ BI.createWidget = function () { if (arguments[0] && arguments[0].element === "body") { - arguments[0].element = wrapper; + arguments[0].element = fixedContainer; } return injectCreate.apply(this, arguments); }; + // Popovers + BI.Popovers = new BI.PopoverController({render: fixedContainer}); + // document.body.onmousedown = scaleFixed; window.addEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). @@ -299,6 +311,9 @@ } BI.createWidget = injectCreate; + // Popovers + BI.Popovers = new BI.PopoverController(); + document.body.onmousedown = null; window.removeEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). 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 daea6ac..c63e581 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -1,7 +1,14 @@ !(function () { var scale = 1, transformY = 0, selected = true; - var wrapper = document.getElementById("wrapper"); var html = document.getElementsByTagName('html')[0]; + var wrapper = document.getElementById("wrapper"); + var fixedContainer = document.createElement('div'); + fixedContainer.style.position = "absolute"; + fixedContainer.style.top = "0"; + fixedContainer.style.left = "0"; + fixedContainer.style.width = "100%"; + + wrapper.appendChild(fixedContainer); var jQuery = $ || window.jQuery; var injectOffset = jQuery.fn.offset; @@ -53,6 +60,7 @@ wrapper.style.transformOrigin = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; + fixedContainer.style.height = (document.body.clientHeight / scale) + "px"; // html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; html.style.backgroundColor = "#ffffff"; @@ -80,6 +88,7 @@ wrapper.style["-ms-transform-origin"] = ""; wrapper.style.overflowY = "hidden"; wrapper.style.top = ""; + fixedContainer.style.height = "0px"; html.style.backgroundColor = "#ffffff"; scale = 1; @@ -274,11 +283,14 @@ BI.createWidget = function () { if (arguments[0] && arguments[0].element === "body") { - arguments[0].element = wrapper; + arguments[0].element = fixedContainer; } return injectCreate.apply(this, arguments); }; + // Popovers + BI.Popovers = new BI.PopoverController({render: fixedContainer}); + // document.body.onmousedown = scaleFixed; window.addEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). @@ -299,6 +311,9 @@ } BI.createWidget = injectCreate; + // Popovers + BI.Popovers = new BI.PopoverController(); + document.body.onmousedown = null; window.removeEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').