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

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

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

Loading…
Cancel
Save