Browse Source

update

feature/10.0
Fay 5 years ago
parent
commit
a1eb41a770
  1. 59
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  2. 59
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

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

@ -1,5 +1,6 @@
!(function () { !(function () {
var scale = 1, transformY = 0, selected = false; var scale = 1, transformY = 0, selected = false;
var wrapper = document.getElementById("wrapper");
var html = document.getElementsByTagName('html')[0]; var html = document.getElementsByTagName('html')[0];
var jQuery = $ || window.jQuery; var jQuery = $ || window.jQuery;
@ -42,12 +43,13 @@
function transformScale() { function transformScale() {
var bounds = getScaleBounds(); var bounds = getScaleBounds();
scale = bounds.scale; scale = bounds.scale;
document.body.style.width = bounds.width + "px"; wrapper.style.position = "relative";
document.body.style.height = bounds.height + "px"; wrapper.style.width = bounds.width + "px";
document.body.style.transform = "scale(" + bounds.scale+ ")"; wrapper.style.height = bounds.height + "px";
document.body.style.transformOrigin = "top left"; wrapper.style.transform = "scale(" + bounds.scale+ ")";
document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style.transformOrigin = "top left";
document.body.style["-ms-transform-origin"] = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
wrapper.style["-ms-transform-origin"] = "top left";
html.style.overflowY = "auto"; html.style.overflowY = "auto";
html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff";
@ -57,26 +59,30 @@
} else { } else {
transformY = 0; transformY = 0;
} }
document.body.style.top = transformY + "px";
document.body.style.top = transformY + "px";
document.body.style.height = (bounds.height * scale) + "px";
document.body.style.overflow = "hidden";
window.scale = window.devicePixelRatio * scale; window.scale = window.devicePixelRatio * scale;
// scaleFixed(); // scaleFixed();
} }
// 取消缩放 // 取消缩放
function removeScale() { function removeScale() {
document.body.style.width = "100%"; wrapper.style.width = "100%";
document.body.style.height = "100%"; wrapper.style.height = "100%";
document.body.style.transform = ""; wrapper.style.transform = "";
document.body.style.transformOrigin = ""; wrapper.style.transformOrigin = "";
document.body.style["-ms-transform"] = ""; wrapper.style["-ms-transform"] = "";
document.body.style["-ms-transform-origin"] = ""; wrapper.style["-ms-transform-origin"] = "";
document.body.style.overflowY = "hidden"; wrapper.style.overflowY = "hidden";
document.body.style.top = "0px";
html.style.backgroundColor = "#ffffff"; html.style.backgroundColor = "#ffffff";
scale = 1; scale = 1;
document.body.style.top = "0px";
document.body.style.width = "";
document.body.style.height = "";
document.body.style.overflowY = "";
window.scale = window.devicePixelRatio / scale; window.scale = window.devicePixelRatio / scale;
// revertFixed(); // revertFixed();
@ -212,7 +218,20 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")"; tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left"; tooltip.element[0].style.transformOrigin = "top left";
} }
jQuery.fn.outerWidth = function () {
var wdith = injectOuterWidth.apply(this, arguments);
if (this[0] === document.body) {
return wdith / scale;
}
return wdith;
}
jQuery.fn.outerHeight = function () {
var height = injectOuterHeight.apply(this, arguments);
if (this[0] === document.body) {
return height / scale;
}
return height;
}
// BI.DOM.getBottomPosition = function (combo, popup, extraHeight) { // BI.DOM.getBottomPosition = function (combo, popup, extraHeight) {
// var el = combo.element; // var el = combo.element;
// return { // return {
@ -237,8 +256,8 @@
jQuery.fn.__isMouseInBounds__ = injectMouseInBounds; jQuery.fn.__isMouseInBounds__ = injectMouseInBounds;
jQuery.fn.offset = injectOffset; jQuery.fn.offset = injectOffset;
jQuery.event.fix = injectEventFix; jQuery.event.fix = injectEventFix;
// jQuery.fn.outerWidth = injectOuterWidth; jQuery.fn.outerWidth = injectOuterWidth;
// jQuery.fn.outerHeight = injectOuterHeight; jQuery.fn.outerHeight = injectOuterHeight;
// jQuery.fn.bounds = injectBounds; // jQuery.fn.bounds = injectBounds;
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = adjustHeight; BI.Combo.prototype.adjustHeight = adjustHeight;
@ -258,7 +277,7 @@
}, 30); }, 30);
function updateScale () { function updateScale () {
if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { if (html.getBoundingClientRect().width !== wrapper.getBoundingClientRect().width) {
selectHandler(); selectHandler();
} }
} }

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

@ -1,5 +1,6 @@
!(function () { !(function () {
var scale = 1, transformY = 0, selected = false; var scale = 1, transformY = 0, selected = false;
var wrapper = document.getElementById("wrapper");
var html = document.getElementsByTagName('html')[0]; var html = document.getElementsByTagName('html')[0];
var jQuery = $ || window.jQuery; var jQuery = $ || window.jQuery;
@ -42,12 +43,13 @@
function transformScale() { function transformScale() {
var bounds = getScaleBounds(); var bounds = getScaleBounds();
scale = bounds.scale; scale = bounds.scale;
document.body.style.width = bounds.width + "px"; wrapper.style.position = "relative";
document.body.style.height = bounds.height + "px"; wrapper.style.width = bounds.width + "px";
document.body.style.transform = "scale(" + bounds.scale+ ")"; wrapper.style.height = bounds.height + "px";
document.body.style.transformOrigin = "top left"; wrapper.style.transform = "scale(" + bounds.scale+ ")";
document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style.transformOrigin = "top left";
document.body.style["-ms-transform-origin"] = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")";
wrapper.style["-ms-transform-origin"] = "top left";
html.style.overflowY = "auto"; html.style.overflowY = "auto";
html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff";
@ -57,26 +59,30 @@
} else { } else {
transformY = 0; transformY = 0;
} }
document.body.style.top = transformY + "px";
document.body.style.top = transformY + "px";
document.body.style.height = (bounds.height * scale) + "px";
document.body.style.overflow = "hidden";
window.scale = window.devicePixelRatio * scale; window.scale = window.devicePixelRatio * scale;
// scaleFixed(); // scaleFixed();
} }
// 取消缩放 // 取消缩放
function removeScale() { function removeScale() {
document.body.style.width = "100%"; wrapper.style.width = "100%";
document.body.style.height = "100%"; wrapper.style.height = "100%";
document.body.style.transform = ""; wrapper.style.transform = "";
document.body.style.transformOrigin = ""; wrapper.style.transformOrigin = "";
document.body.style["-ms-transform"] = ""; wrapper.style["-ms-transform"] = "";
document.body.style["-ms-transform-origin"] = ""; wrapper.style["-ms-transform-origin"] = "";
document.body.style.overflowY = "hidden"; wrapper.style.overflowY = "hidden";
document.body.style.top = "0px";
html.style.backgroundColor = "#ffffff"; html.style.backgroundColor = "#ffffff";
scale = 1; scale = 1;
document.body.style.top = "0px";
document.body.style.width = "";
document.body.style.height = "";
document.body.style.overflowY = "";
window.scale = window.devicePixelRatio / scale; window.scale = window.devicePixelRatio / scale;
// revertFixed(); // revertFixed();
@ -212,7 +218,20 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")"; tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left"; tooltip.element[0].style.transformOrigin = "top left";
} }
jQuery.fn.outerWidth = function () {
var wdith = injectOuterWidth.apply(this, arguments);
if (this[0] === document.body) {
return wdith / scale;
}
return wdith;
}
jQuery.fn.outerHeight = function () {
var height = injectOuterHeight.apply(this, arguments);
if (this[0] === document.body) {
return height / scale;
}
return height;
}
// BI.DOM.getBottomPosition = function (combo, popup, extraHeight) { // BI.DOM.getBottomPosition = function (combo, popup, extraHeight) {
// var el = combo.element; // var el = combo.element;
// return { // return {
@ -237,12 +256,12 @@
jQuery.fn.__isMouseInBounds__ = injectMouseInBounds; jQuery.fn.__isMouseInBounds__ = injectMouseInBounds;
jQuery.fn.offset = injectOffset; jQuery.fn.offset = injectOffset;
jQuery.event.fix = injectEventFix; jQuery.event.fix = injectEventFix;
// jQuery.fn.outerWidth = injectOuterWidth;
// jQuery.fn.outerHeight = injectOuterHeight;
// jQuery.fn.bounds = injectBounds; // jQuery.fn.bounds = injectBounds;
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = adjustHeight; BI.Combo.prototype.adjustHeight = adjustHeight;
BI.Tooltips.show = injectToolTipShow; BI.Tooltips.show = injectToolTipShow;
jQuery.fn.outerWidth = injectOuterWidth;
jQuery.fn.outerHeight = injectOuterHeight;
} }
document.body.onmousedown = null; document.body.onmousedown = null;
@ -258,7 +277,7 @@
}, 30); }, 30);
function updateScale () { function updateScale () {
if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { if (html.getBoundingClientRect().width !== wrapper.getBoundingClientRect().width) {
selectHandler(); selectHandler();
} }
} }

Loading…
Cancel
Save