From 2ed37a0bd5e06de2028ec80d3f5f1938aa520089 Mon Sep 17 00:00:00 2001 From: fay Date: Thu, 18 Jul 2019 16:37:42 +0800 Subject: [PATCH 01/12] build.xml edited online with Bitbucket --- build.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 4e77e23..ac37dbf 100644 --- a/build.xml +++ b/build.xml @@ -5,7 +5,7 @@ - + @@ -139,4 +139,4 @@ - \ No newline at end of file + From fd6d1ee4cdf545b04105ebbc082d578ee31d2b7b Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 22 Jul 2019 09:18:47 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.xml b/plugin.xml index 2026b84..e136b0e 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,9 +1,9 @@ - com.finebi.plugin.screen_adaptive + com.finebi.plugin.screenadaptive yes - 1.1.19 + 1.1.30 10.0 2019-03-01 fay From 33bcdd9ffbc5835904c51b466548b05dad6d626c Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 22 Jul 2019 09:46:36 +0800 Subject: [PATCH 03/12] =?UTF-8?q?BI-48301=20&=20BI-48300=20&=20BI-48309?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finebi/plugin/web/plugin.screen_adaptive.js | 14 +++++++++----- .../com/finebi/plugin/web/scripts/entry.js | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) 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 92a6ab5..23768a8 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 @@ -30,7 +30,7 @@ document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; document.body.style["-ms-transform-origin"] = "top left"; html.style.overflowY = "auto"; - html.style.backgroundColor = "#2c3d59"; + html.style.backgroundColor = "#ffffff"; if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; @@ -56,8 +56,8 @@ document.body.style.top = "0px"; html.style.backgroundColor = "#ffffff"; - window.scale = window.devicePixelRatio / scale; scale = 1; + window.scale = window.devicePixelRatio / scale; } // 获取缩放倍数,原模板宽高 @@ -83,13 +83,13 @@ } }); - var templateWidth = Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1))); - var templateHeight = Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1))); + var templateWidth = (Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)))) + 60; + var templateHeight = (Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)))) + 30; var scaleRatio = parseFloat((html.clientWidth / templateWidth).toFixed(1)); return { scale: scaleRatio, width: html.clientWidth / scaleRatio, - height: templateHeight + height: scaleRatio === 1 ? html.clientHeight : templateHeight }; } @@ -167,6 +167,8 @@ } window.addEventListener('resize', updateScale); + window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). + addListener(selectHandler); } function restoreEnv() { @@ -177,6 +179,8 @@ } window.removeEventListener('resize', updateScale); + window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). + removeListener(selectHandler); } function selectHandler () { 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 92a6ab5..23768a8 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -30,7 +30,7 @@ document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; document.body.style["-ms-transform-origin"] = "top left"; html.style.overflowY = "auto"; - html.style.backgroundColor = "#2c3d59"; + html.style.backgroundColor = "#ffffff"; if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; @@ -56,8 +56,8 @@ document.body.style.top = "0px"; html.style.backgroundColor = "#ffffff"; - window.scale = window.devicePixelRatio / scale; scale = 1; + window.scale = window.devicePixelRatio / scale; } // 获取缩放倍数,原模板宽高 @@ -83,13 +83,13 @@ } }); - var templateWidth = Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1))); - var templateHeight = Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1))); + var templateWidth = (Math.round((right / (layoutRatio.x || 1)) || (freeRight / (freeLayoutRatio.x || 1)))) + 60; + var templateHeight = (Math.round((bottom / (layoutRatio.y || 1)) || (freeBottom / (freeLayoutRatio.y || 1)))) + 30; var scaleRatio = parseFloat((html.clientWidth / templateWidth).toFixed(1)); return { scale: scaleRatio, width: html.clientWidth / scaleRatio, - height: templateHeight + height: scaleRatio === 1 ? html.clientHeight : templateHeight }; } @@ -167,6 +167,8 @@ } window.addEventListener('resize', updateScale); + window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). + addListener(selectHandler); } function restoreEnv() { @@ -177,6 +179,8 @@ } window.removeEventListener('resize', updateScale); + window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). + removeListener(selectHandler); } function selectHandler () { From 6523685b4ccf6851db9abfaf27e62a03f601126a Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 22 Jul 2019 13:55:58 +0800 Subject: [PATCH 04/12] BI-48301 & BI-48300 --- .../resources/com/finebi/plugin/web/plugin.screen_adaptive.js | 2 +- src/main/resources/com/finebi/plugin/web/scripts/entry.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 23768a8..0f04026 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 @@ -30,7 +30,7 @@ document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; document.body.style["-ms-transform-origin"] = "top left"; html.style.overflowY = "auto"; - html.style.backgroundColor = "#ffffff"; + html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; 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 23768a8..0f04026 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -30,7 +30,7 @@ document.body.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; document.body.style["-ms-transform-origin"] = "top left"; html.style.overflowY = "auto"; - html.style.backgroundColor = "#ffffff"; + html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; From 1da04df391dd51bba3bedc10db00366640f91473 Mon Sep 17 00:00:00 2001 From: Fay Date: Wed, 24 Jul 2019 10:21:07 +0800 Subject: [PATCH 05/12] =?UTF-8?q?CHART-9916=20fix=EF=BC=9Atop=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/finebi/plugin/web/plugin.screen_adaptive.js | 6 +++--- src/main/resources/com/finebi/plugin/web/scripts/entry.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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 0f04026..cb7596f 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 @@ -34,11 +34,11 @@ if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; - document.body.style.top = transformY + "px"; html.style.overflowY = "hidden"; } else { transformY = 0; } + document.body.style.top = transformY + "px"; window.scale = window.devicePixelRatio * scale; @@ -183,11 +183,11 @@ removeListener(selectHandler); } - function selectHandler () { + var selectHandler = BI.debounce(function () { selected && prepareEnv(); selected ? transformScale() : removeScale(); !selected && restoreEnv(); - } + }, 30); function updateScale () { if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { 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 0f04026..cb7596f 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -34,11 +34,11 @@ if (bounds.height * bounds.scale < html.clientHeight) { transformY = (html.clientHeight - bounds.height * bounds.scale) / 2; - document.body.style.top = transformY + "px"; html.style.overflowY = "hidden"; } else { transformY = 0; } + document.body.style.top = transformY + "px"; window.scale = window.devicePixelRatio * scale; @@ -183,11 +183,11 @@ removeListener(selectHandler); } - function selectHandler () { + var selectHandler = BI.debounce(function () { selected && prepareEnv(); selected ? transformScale() : removeScale(); !selected && restoreEnv(); - } + }, 30); function updateScale () { if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { From 5b3c549028fed9c9a4c6dd3cb09c778fa99bbbac Mon Sep 17 00:00:00 2001 From: Fay Date: Thu, 25 Jul 2019 16:04:35 +0800 Subject: [PATCH 06/12] =?UTF-8?q?BI-48558=20fix:=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/web/plugin.screen_adaptive.js | 220 +++++++++++++----- .../com/finebi/plugin/web/scripts/entry.js | 220 +++++++++++++----- 2 files changed, 312 insertions(+), 128 deletions(-) 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 cb7596f..2dceb4e 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 @@ -6,6 +6,11 @@ var injectOffset = jQuery.fn.offset; var injectEventFix = jQuery.event.fix; var injectMouseInBounds = jQuery.fn.__isMouseInBounds__; + var injectToolTipShow = null; + var adjustHeight = BI.Combo.prototype.adjustHeight; + var injectOuterWidth = jQuery.fn.outerWidth; + var injectOuterHeight = jQuery.fn.outerHeight; + var injectBounds = jQuery.fn.bounds; // 修正事件偏移 function correctEvent(e) { @@ -19,6 +24,20 @@ return e; } + function checkInPopupView(el) { + var t = el.parentElement; + var flag = false; + do { + if (t.className && t.className.indexOf("bi-popup-view") !== -1) { + flag = true; + break; + } + t = t.parentElement + } while (t); + + return flag; + } + // 进行缩放 function transformScale() { var bounds = getScaleBounds(); @@ -42,6 +61,7 @@ window.scale = window.devicePixelRatio * scale; + // scaleFixed(); } // 取消缩放 @@ -58,6 +78,8 @@ scale = 1; window.scale = window.devicePixelRatio / scale; + + // revertFixed(); } // 获取缩放倍数,原模板宽高 @@ -96,88 +118,134 @@ // 准备环境,主要是纠正事件偏移 function prepareEnv() { // IE的fixed元素不受transform:scale影响 - if (!BI.isIE()) { - jQuery.fn.__isMouseInBounds__ = function (e) { - var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); - var width = offset2Body.width || this.outerWidth(); - var height = offset2Body.height || this.outerHeight(); - var pageX = e.pageX * scale, - pageY = e.pageY * scale + transformY; - return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width - || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); - }; - jQuery.fn.offset = function( options ) { - function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; - } + injectToolTipShow = injectToolTipShow || BI.Tooltips.show; + jQuery.fn.__isMouseInBounds__ = function (e) { + var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); + var width = offset2Body.width || this.outerWidth(); + var height = offset2Body.height || this.outerHeight(); + var pageX = e.pageX * scale, + pageY = e.pageY * scale + transformY; + return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width + || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); + }; + jQuery.fn.offset = function( options ) { + function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; + } - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } - var docElem, win, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - if ( !doc ) { - return; - } + var docElem, win, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; - docElem = doc.documentElement; + if ( !doc ) { + return; + } - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } + docElem = doc.documentElement; - var el = elem, - offsetLeft = 0, - offsetTop = 0; - - do{ - offsetLeft += el.offsetLeft; - offsetTop += el.offsetTop; - el = el.offsetParent; - } while( el ); - - var elm = elem; - 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 ), - left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) - }; + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + var el = elem, + offsetLeft = 0, + offsetTop = 0; + + do{ + offsetLeft += el.offsetLeft; + offsetTop += el.offsetTop; + el = el.offsetParent; + } while( el ); + + var elm = elem; + 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 ), + left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) }; - jQuery.event.fix = function ( e ) { - return correctEvent(injectEventFix.call(this, e)); + }; + + jQuery.event.fix = function ( e ) { + return correctEvent(injectEventFix.call(this, e)); + }; + if (BI.isIE()) { + + + BI.Combo.prototype.adjustHeight = function (e) { + adjustHeight.call(this, e); + if (this.popupView) { + if (!checkInPopupView(this.popupView.element[0])) { + this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale + "px"; + this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale + transformY + "px"; + } else { + + } + this.popupView.element[0].style.transform = "scale(" + scale+ ")"; + this.popupView.element[0].style.transformOrigin = "top left"; + } }; + BI.Tooltips.show = function (e, name, text, level, context, opt) { + injectToolTipShow.call(this, e, name, text, level, 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"; + } + + // BI.DOM.getBottomPosition = function (combo, popup, extraHeight) { + // var el = combo.element; + // return { + // top: el.offset().top + el.outerHeight() * (1 - checkInPopupView(el[0]) ? scale : 0) + (extraHeight || 0) + // }; + // } + // BI.DOM.getRightPosition = function (combo, popup, extraWidth) { + // var el = combo.element; + // return { + // left: el.offset().left + el.outerWidth() * (1-checkInPopupView(el[0]) ? scale : 0) + (extraWidth || 0) + // }; + // } } + // document.body.onmousedown = scaleFixed; window.addEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). addListener(selectHandler); } function restoreEnv() { - if (!BI.isIE()) { - jQuery.fn.__isMouseInBounds__ = injectMouseInBounds; - jQuery.fn.offset = injectOffset; - jQuery.event.fix = injectEventFix; + 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; } + document.body.onmousedown = null; window.removeEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). removeListener(selectHandler); @@ -209,6 +277,30 @@ } } injectMouseMoveTracker(); + // popupview + // function scaleFixed() { + // if (BI.isIE()) { + // var fixedList = document.getElementsByClassName("bi-popup-view"); + // BI.each(fixedList, function (i, el) { + // if (window.getComputedStyle(el).position === 'fixed') { + // el.style.transformOrigin = "top left"; + // el.style.transform = "scale(" + scale + ")"; + // } + // }) + // } + // } + // + // function revertFixed() { + // if (BI.isIE()) { + // var fixedList = document.getElementsByClassName("bi-popup-view"); + // BI.each(fixedList, function (i, el) { + // if (window.getComputedStyle(el).position === 'fixed') { + // el.style.transformOrigin = ""; + // el.style.transform = ""; + // } + // }) + // } + // } BI.config("bi.constant.dashboard.toolbar.left.items", function (config) { return BI.concat(config, [{ 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 cb7596f..2dceb4e 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -6,6 +6,11 @@ var injectOffset = jQuery.fn.offset; var injectEventFix = jQuery.event.fix; var injectMouseInBounds = jQuery.fn.__isMouseInBounds__; + var injectToolTipShow = null; + var adjustHeight = BI.Combo.prototype.adjustHeight; + var injectOuterWidth = jQuery.fn.outerWidth; + var injectOuterHeight = jQuery.fn.outerHeight; + var injectBounds = jQuery.fn.bounds; // 修正事件偏移 function correctEvent(e) { @@ -19,6 +24,20 @@ return e; } + function checkInPopupView(el) { + var t = el.parentElement; + var flag = false; + do { + if (t.className && t.className.indexOf("bi-popup-view") !== -1) { + flag = true; + break; + } + t = t.parentElement + } while (t); + + return flag; + } + // 进行缩放 function transformScale() { var bounds = getScaleBounds(); @@ -42,6 +61,7 @@ window.scale = window.devicePixelRatio * scale; + // scaleFixed(); } // 取消缩放 @@ -58,6 +78,8 @@ scale = 1; window.scale = window.devicePixelRatio / scale; + + // revertFixed(); } // 获取缩放倍数,原模板宽高 @@ -96,88 +118,134 @@ // 准备环境,主要是纠正事件偏移 function prepareEnv() { // IE的fixed元素不受transform:scale影响 - if (!BI.isIE()) { - jQuery.fn.__isMouseInBounds__ = function (e) { - var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); - var width = offset2Body.width || this.outerWidth(); - var height = offset2Body.height || this.outerHeight(); - var pageX = e.pageX * scale, - pageY = e.pageY * scale + transformY; - return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width - || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); - }; - jQuery.fn.offset = function( options ) { - function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; - } + injectToolTipShow = injectToolTipShow || BI.Tooltips.show; + jQuery.fn.__isMouseInBounds__ = function (e) { + var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); + var width = offset2Body.width || this.outerWidth(); + var height = offset2Body.height || this.outerHeight(); + var pageX = e.pageX * scale, + pageY = e.pageY * scale + transformY; + return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width + || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); + }; + jQuery.fn.offset = function( options ) { + function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; + } - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } - var docElem, win, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - if ( !doc ) { - return; - } + var docElem, win, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; - docElem = doc.documentElement; + if ( !doc ) { + return; + } - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } + docElem = doc.documentElement; - var el = elem, - offsetLeft = 0, - offsetTop = 0; - - do{ - offsetLeft += el.offsetLeft; - offsetTop += el.offsetTop; - el = el.offsetParent; - } while( el ); - - var elm = elem; - 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 ), - left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) - }; + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + var el = elem, + offsetLeft = 0, + offsetTop = 0; + + do{ + offsetLeft += el.offsetLeft; + offsetTop += el.offsetTop; + el = el.offsetParent; + } while( el ); + + var elm = elem; + 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 ), + left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) }; - jQuery.event.fix = function ( e ) { - return correctEvent(injectEventFix.call(this, e)); + }; + + jQuery.event.fix = function ( e ) { + return correctEvent(injectEventFix.call(this, e)); + }; + if (BI.isIE()) { + + + BI.Combo.prototype.adjustHeight = function (e) { + adjustHeight.call(this, e); + if (this.popupView) { + if (!checkInPopupView(this.popupView.element[0])) { + this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale + "px"; + this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale + transformY + "px"; + } else { + + } + this.popupView.element[0].style.transform = "scale(" + scale+ ")"; + this.popupView.element[0].style.transformOrigin = "top left"; + } }; + BI.Tooltips.show = function (e, name, text, level, context, opt) { + injectToolTipShow.call(this, e, name, text, level, 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"; + } + + // BI.DOM.getBottomPosition = function (combo, popup, extraHeight) { + // var el = combo.element; + // return { + // top: el.offset().top + el.outerHeight() * (1 - checkInPopupView(el[0]) ? scale : 0) + (extraHeight || 0) + // }; + // } + // BI.DOM.getRightPosition = function (combo, popup, extraWidth) { + // var el = combo.element; + // return { + // left: el.offset().left + el.outerWidth() * (1-checkInPopupView(el[0]) ? scale : 0) + (extraWidth || 0) + // }; + // } } + // document.body.onmousedown = scaleFixed; window.addEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). addListener(selectHandler); } function restoreEnv() { - if (!BI.isIE()) { - jQuery.fn.__isMouseInBounds__ = injectMouseInBounds; - jQuery.fn.offset = injectOffset; - jQuery.event.fix = injectEventFix; + 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; } + document.body.onmousedown = null; window.removeEventListener('resize', updateScale); window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). removeListener(selectHandler); @@ -209,6 +277,30 @@ } } injectMouseMoveTracker(); + // popupview + // function scaleFixed() { + // if (BI.isIE()) { + // var fixedList = document.getElementsByClassName("bi-popup-view"); + // BI.each(fixedList, function (i, el) { + // if (window.getComputedStyle(el).position === 'fixed') { + // el.style.transformOrigin = "top left"; + // el.style.transform = "scale(" + scale + ")"; + // } + // }) + // } + // } + // + // function revertFixed() { + // if (BI.isIE()) { + // var fixedList = document.getElementsByClassName("bi-popup-view"); + // BI.each(fixedList, function (i, el) { + // if (window.getComputedStyle(el).position === 'fixed') { + // el.style.transformOrigin = ""; + // el.style.transform = ""; + // } + // }) + // } + // } BI.config("bi.constant.dashboard.toolbar.left.items", function (config) { return BI.concat(config, [{ From a1eb41a7706da71595f1f9d7498040e9248ee9c7 Mon Sep 17 00:00:00 2001 From: Fay Date: Thu, 25 Jul 2019 17:26:27 +0800 Subject: [PATCH 07/12] update --- .../plugin/web/plugin.screen_adaptive.js | 59 ++++++++++++------- .../com/finebi/plugin/web/scripts/entry.js | 59 ++++++++++++------- 2 files changed, 78 insertions(+), 40 deletions(-) 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 2dceb4e..3e7d34b 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,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(); } } 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 2dceb4e..055abd8 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/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(); } } From 88fcc411d0f3e6c634750b3686603f7c13a8dfbb Mon Sep 17 00:00:00 2001 From: Fay Date: Thu, 25 Jul 2019 19:08:17 +0800 Subject: [PATCH 08/12] update --- .../plugin/web/plugin.screen_adaptive.js | 75 ++++++++++--------- .../com/finebi/plugin/web/scripts/entry.js | 71 +++++++++--------- 2 files changed, 74 insertions(+), 72 deletions(-) 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 3e7d34b..d272452 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 @@ -43,13 +43,14 @@ function transformScale() { var bounds = getScaleBounds(); scale = bounds.scale; - 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"; + document.body.style.position = "relative"; + 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"; + document.body.style.top = transformY + "px"; html.style.overflowY = "auto"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; @@ -60,29 +61,29 @@ transformY = 0; } - document.body.style.top = transformY + "px"; - document.body.style.height = (bounds.height * scale) + "px"; - document.body.style.overflow = "hidden"; + // document.body.style.height = (bounds.height * scale) + "px"; + // document.body.style.overflow = "hidden"; window.scale = window.devicePixelRatio * scale; // scaleFixed(); } // 取消缩放 function removeScale() { - 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"; + 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 = ""; html.style.backgroundColor = "#ffffff"; scale = 1; - document.body.style.top = "0px"; - document.body.style.width = ""; - document.body.style.height = ""; - document.body.style.overflowY = ""; + // document.body.style.top = "0px"; + // document.body.style.width = ""; + // document.body.style.height = ""; + // document.body.style.overflowY = ""; window.scale = window.devicePixelRatio / scale; // revertFixed(); @@ -218,20 +219,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; - } + // 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 { @@ -256,12 +257,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; 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 055abd8..d272452 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -43,13 +43,14 @@ function transformScale() { var bounds = getScaleBounds(); scale = bounds.scale; - 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"; + document.body.style.position = "relative"; + 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"; + document.body.style.top = transformY + "px"; html.style.overflowY = "auto"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; @@ -60,29 +61,29 @@ transformY = 0; } - document.body.style.top = transformY + "px"; - document.body.style.height = (bounds.height * scale) + "px"; - document.body.style.overflow = "hidden"; + // document.body.style.height = (bounds.height * scale) + "px"; + // document.body.style.overflow = "hidden"; window.scale = window.devicePixelRatio * scale; // scaleFixed(); } // 取消缩放 function removeScale() { - 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"; + 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 = ""; html.style.backgroundColor = "#ffffff"; scale = 1; - document.body.style.top = "0px"; - document.body.style.width = ""; - document.body.style.height = ""; - document.body.style.overflowY = ""; + // document.body.style.top = "0px"; + // document.body.style.width = ""; + // document.body.style.height = ""; + // document.body.style.overflowY = ""; window.scale = window.devicePixelRatio / scale; // revertFixed(); @@ -218,20 +219,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; - } + // 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 { From d0c6a3d98adb0b6ab5c3260d53a8ec2721dbfd00 Mon Sep 17 00:00:00 2001 From: Fay Date: Fri, 26 Jul 2019 09:28:39 +0800 Subject: [PATCH 09/12] update --- .../com/finebi/plugin/web/plugin.screen_adaptive.js | 9 ++++----- .../resources/com/finebi/plugin/web/scripts/entry.js | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 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 d272452..2372d8d 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 @@ -43,14 +43,12 @@ function transformScale() { var bounds = getScaleBounds(); scale = bounds.scale; - document.body.style.position = "relative"; 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"; - document.body.style.top = transformY + "px"; html.style.overflowY = "auto"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; @@ -63,6 +61,7 @@ // document.body.style.height = (bounds.height * scale) + "px"; // document.body.style.overflow = "hidden"; + document.body.style.top = transformY + "px"; window.scale = window.devicePixelRatio * scale; // scaleFixed(); } @@ -261,8 +260,8 @@ if (BI.isIE()) { BI.Combo.prototype.adjustHeight = adjustHeight; BI.Tooltips.show = injectToolTipShow; - jQuery.fn.outerWidth = injectOuterWidth; - jQuery.fn.outerHeight = injectOuterHeight; + // jQuery.fn.outerWidth = injectOuterWidth; + // jQuery.fn.outerHeight = injectOuterHeight; } document.body.onmousedown = null; @@ -278,7 +277,7 @@ }, 30); function updateScale () { - if (html.getBoundingClientRect().width !== wrapper.getBoundingClientRect().width) { + if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { selectHandler(); } } 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 d272452..2372d8d 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -43,14 +43,12 @@ function transformScale() { var bounds = getScaleBounds(); scale = bounds.scale; - document.body.style.position = "relative"; 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"; - document.body.style.top = transformY + "px"; html.style.overflowY = "auto"; html.style.backgroundColor = document.getElementsByClassName('bi-theme-dark').length === 0 ? "#2c3d59" : "#ffffff"; @@ -63,6 +61,7 @@ // document.body.style.height = (bounds.height * scale) + "px"; // document.body.style.overflow = "hidden"; + document.body.style.top = transformY + "px"; window.scale = window.devicePixelRatio * scale; // scaleFixed(); } @@ -261,8 +260,8 @@ if (BI.isIE()) { BI.Combo.prototype.adjustHeight = adjustHeight; BI.Tooltips.show = injectToolTipShow; - jQuery.fn.outerWidth = injectOuterWidth; - jQuery.fn.outerHeight = injectOuterHeight; + // jQuery.fn.outerWidth = injectOuterWidth; + // jQuery.fn.outerHeight = injectOuterHeight; } document.body.onmousedown = null; @@ -278,7 +277,7 @@ }, 30); function updateScale () { - if (html.getBoundingClientRect().width !== wrapper.getBoundingClientRect().width) { + if (html.getBoundingClientRect().width !== document.body.getBoundingClientRect().width) { selectHandler(); } } From 8daba057cd3708de4592ac0237f7454354561f6a Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 5 Aug 2019 11:38:21 +0800 Subject: [PATCH 10/12] =?UTF-8?q?BI-49097=20=E4=BD=8D=E7=BD=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/web/plugin.screen_adaptive.js | 23 +++++++++++++++---- .../com/finebi/plugin/web/scripts/entry.js | 23 +++++++++++++++---- 2 files changed, 36 insertions(+), 10 deletions(-) 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 2372d8d..2520493 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 @@ -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) { 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 2372d8d..2520493 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/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) { From 0f59034a982174a8405ad8b26c95ba8d1fa95b5a Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 5 Aug 2019 11:39:34 +0800 Subject: [PATCH 11/12] update --- .../resources/com/finebi/plugin/web/plugin.screen_adaptive.js | 1 + src/main/resources/com/finebi/plugin/web/scripts/entry.js | 1 + 2 files changed, 2 insertions(+) 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 2520493..31dcff5 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 @@ -273,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; } 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 2520493..31dcff5 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -273,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; } From 83631205e7378dfea1cd3bed135b87e1ac45012b Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 5 Aug 2019 12:13:15 +0800 Subject: [PATCH 12/12] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96inBounds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/finebi/plugin/web/plugin.screen_adaptive.js | 4 ++-- src/main/resources/com/finebi/plugin/web/scripts/entry.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 31dcff5..72abb68 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 @@ -131,8 +131,8 @@ var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); var width = offset2Body.width || this.outerWidth(); var height = offset2Body.height || this.outerHeight(); - var pageX = e.pageX * scale, - pageY = e.pageY * scale + transformY; + var pageX = e.clientX * scale, + pageY = e.clientY * scale + transformY; return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); }; 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 31dcff5..72abb68 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -131,8 +131,8 @@ var offset2Body = this.get(0).getBoundingClientRect ? this.get(0).getBoundingClientRect() : this.offset(); var width = offset2Body.width || this.outerWidth(); var height = offset2Body.height || this.outerHeight(); - var pageX = e.pageX * scale, - pageY = e.pageY * scale + transformY; + var pageX = e.clientX * scale, + pageY = e.clientY * scale + transformY; return !(pageX < Math.floor(offset2Body.left) || pageX > offset2Body.left + width || pageY < Math.floor(offset2Body.top) || pageY > offset2Body.top + height); };