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)').