Browse Source

Merge pull request #7 in PG/plugin-bi-screen-adaptive from ~FAY/plugin-bi-screen-adaptive:release/10.0 to release/10.0

* commit '0f59034a982174a8405ad8b26c95ba8d1fa95b5a':
  update
  BI-49097 位置问题
feature/10.0
fay 5 years ago
parent
commit
a1504ad486
  1. 24
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  2. 24
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

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

@ -8,6 +8,7 @@
var injectEventFix = jQuery.event.fix; var injectEventFix = jQuery.event.fix;
var injectMouseInBounds = jQuery.fn.__isMouseInBounds__; var injectMouseInBounds = jQuery.fn.__isMouseInBounds__;
var injectToolTipShow = null; var injectToolTipShow = null;
var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight; var adjustHeight = BI.Combo.prototype.adjustHeight;
var injectOuterWidth = jQuery.fn.outerWidth; var injectOuterWidth = jQuery.fn.outerWidth;
var injectOuterHeight = jQuery.fn.outerHeight; var injectOuterHeight = jQuery.fn.outerHeight;
@ -125,6 +126,7 @@
function prepareEnv() { function prepareEnv() {
// IE的fixed元素不受transform:scale影响 // IE的fixed元素不受transform:scale影响
injectToolTipShow = injectToolTipShow || BI.Tooltips.show; injectToolTipShow = injectToolTipShow || BI.Tooltips.show;
injectBubblesShow = injectBubblesShow || BI.Bubbles.show;
jQuery.fn.__isMouseInBounds__ = function (e) { jQuery.fn.__isMouseInBounds__ = function (e) {
var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset();
var width = offset2Body.width || this.outerWidth(); var width = offset2Body.width || this.outerWidth();
@ -179,11 +181,14 @@
} while( el ); } while( el );
var elm = elem; var elm = elem;
do{ // 不知道该怎么写代码了,就这样了
offsetLeft -= elm.scrollLeft || 0; if (!checkInPopupView(elm)) {
offsetTop -= elm.scrollTop || 0; do{
elm = elm.parentNode; offsetLeft -= elm.scrollLeft || 0;
} while( elm ); offsetTop -= elm.scrollTop || 0;
elm = elm.parentNode;
} while( elm );
}
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
@ -218,6 +223,14 @@
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";
} }
BI.Bubbles.show = function (name, text, context, opt) {
injectBubblesShow.call(this, name, text, context, opt);
var tooltip = this.get(name);
tooltip.element[0].style.left = parseInt(tooltip.element[0].style.left) * scale + "px";
tooltip.element[0].style.top = parseInt(tooltip.element[0].style.top) * scale + transformY + "px";
tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left";
}
// jQuery.fn.outerWidth = function () { // jQuery.fn.outerWidth = function () {
// var wdith = injectOuterWidth.apply(this, arguments); // var wdith = injectOuterWidth.apply(this, arguments);
// if (this[0] === document.body) { // if (this[0] === document.body) {
@ -260,6 +273,7 @@
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = adjustHeight; BI.Combo.prototype.adjustHeight = adjustHeight;
BI.Tooltips.show = injectToolTipShow; BI.Tooltips.show = injectToolTipShow;
BI.Bubbles.show = injectBubblesShow;
// jQuery.fn.outerWidth = injectOuterWidth; // jQuery.fn.outerWidth = injectOuterWidth;
// jQuery.fn.outerHeight = injectOuterHeight; // jQuery.fn.outerHeight = injectOuterHeight;
} }

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

@ -8,6 +8,7 @@
var injectEventFix = jQuery.event.fix; var injectEventFix = jQuery.event.fix;
var injectMouseInBounds = jQuery.fn.__isMouseInBounds__; var injectMouseInBounds = jQuery.fn.__isMouseInBounds__;
var injectToolTipShow = null; var injectToolTipShow = null;
var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight; var adjustHeight = BI.Combo.prototype.adjustHeight;
var injectOuterWidth = jQuery.fn.outerWidth; var injectOuterWidth = jQuery.fn.outerWidth;
var injectOuterHeight = jQuery.fn.outerHeight; var injectOuterHeight = jQuery.fn.outerHeight;
@ -125,6 +126,7 @@
function prepareEnv() { function prepareEnv() {
// IE的fixed元素不受transform:scale影响 // IE的fixed元素不受transform:scale影响
injectToolTipShow = injectToolTipShow || BI.Tooltips.show; injectToolTipShow = injectToolTipShow || BI.Tooltips.show;
injectBubblesShow = injectBubblesShow || BI.Bubbles.show;
jQuery.fn.__isMouseInBounds__ = function (e) { jQuery.fn.__isMouseInBounds__ = function (e) {
var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset();
var width = offset2Body.width || this.outerWidth(); var width = offset2Body.width || this.outerWidth();
@ -179,11 +181,14 @@
} while( el ); } while( el );
var elm = elem; var elm = elem;
do{ // 不知道该怎么写代码了,就这样了
offsetLeft -= elm.scrollLeft || 0; if (!checkInPopupView(elm)) {
offsetTop -= elm.scrollTop || 0; do{
elm = elm.parentNode; offsetLeft -= elm.scrollLeft || 0;
} while( elm ); offsetTop -= elm.scrollTop || 0;
elm = elm.parentNode;
} while( elm );
}
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
@ -218,6 +223,14 @@
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";
} }
BI.Bubbles.show = function (name, text, context, opt) {
injectBubblesShow.call(this, name, text, context, opt);
var tooltip = this.get(name);
tooltip.element[0].style.left = parseInt(tooltip.element[0].style.left) * scale + "px";
tooltip.element[0].style.top = parseInt(tooltip.element[0].style.top) * scale + transformY + "px";
tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left";
}
// jQuery.fn.outerWidth = function () { // jQuery.fn.outerWidth = function () {
// var wdith = injectOuterWidth.apply(this, arguments); // var wdith = injectOuterWidth.apply(this, arguments);
// if (this[0] === document.body) { // if (this[0] === document.body) {
@ -260,6 +273,7 @@
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = adjustHeight; BI.Combo.prototype.adjustHeight = adjustHeight;
BI.Tooltips.show = injectToolTipShow; BI.Tooltips.show = injectToolTipShow;
BI.Bubbles.show = injectBubblesShow;
// jQuery.fn.outerWidth = injectOuterWidth; // jQuery.fn.outerWidth = injectOuterWidth;
// jQuery.fn.outerHeight = injectOuterHeight; // jQuery.fn.outerHeight = injectOuterHeight;
} }

Loading…
Cancel
Save