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

Loading…
Cancel
Save