diff --git a/plugin.xml b/plugin.xml index 86bc47b..0a62366 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ com.finebi.plugin.screenadaptive yes - 1.1.41 + 1.1.42 10.0 2019-08-16 fay 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 ee4ac9b..2e4bd54 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 @@ -110,7 +110,7 @@ wrapper.style.overflow = "hidden"; html.style.backgroundColor = "#ffffff"; - scrollContainer.style.overflowX = "auto"; + scrollContainer.style.overflowX = globalScaleRatio === null ? "hidden" : "auto"; scrollContainer.style.overflowY = "auto"; fixedWrapper.style.overflow = "hidden"; fixedWrapper.style.width = bounds.width * scale + "px"; @@ -284,37 +284,37 @@ if (BI.isIE()) { BI.Combo.prototype.adjustHeight = function (e) { adjustHeight.call(this, e); - var transformX = 0, transformY = 0; + var transformX = scrollContainer.scrollLeft; + var transformY = scrollContainer.scrollTop; if (this.popupView) { if (!checkInPopupView(this.popupView.element[0])) { - transformX = scrollContainer.scrollLeft; - transformY = scrollContainer.scrollTop; this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px"; this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale - transformY + "px"; } else { var cBounds = BI.extend({}, this.popupView.element[0].getBoundingClientRect()); var pBounds = BI.extend({}, this.popupView.element[0].parentElement.getBoundingClientRect()); + var hasScale = this.popupView.element[0].style.transform && this.popupView.element[0].style.transform.includes("scale"); var minWidth = parseInt(this.popupView.element[0].style.minWidth); var minHeight = parseInt(this.popupView.element[0].style.minHeight); cBounds.width = Math.max(cBounds.width, minWidth * scale); cBounds.height = Math.max(cBounds.height, minHeight * scale); - if (cBounds.left + cBounds.width - scrollContainer.scrollLeft> body.clientWidth * scale) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; + if ((cBounds.left * scale + cBounds.width * (hasScale ? 1 : scale)) - transformX > body.clientWidth) { + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px"; } else if (this.options.direction === "right") { - this.popupView.element[0].style.top = parseInt(pBounds.top) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(pBounds.right) - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.top) + "px"; + this.popupView.element[0].style.left = parseInt(pBounds.right) + "px"; } else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(pBounds.left) - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; + this.popupView.element[0].style.left = parseInt(pBounds.left) + "px"; }else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; this.popupView.element[0].style.left = parseInt(Math.min(pBounds.left, body.clientWidth - cBounds.width)) - transformX + "px"; } else { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; + this.popupView.element[0].style.left = parseInt(cBounds.left) * scale + "px"; } } this.popupView.element[0].style.transform = "scale(" + scale+ ")"; 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 ee4ac9b..2e4bd54 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -110,7 +110,7 @@ wrapper.style.overflow = "hidden"; html.style.backgroundColor = "#ffffff"; - scrollContainer.style.overflowX = "auto"; + scrollContainer.style.overflowX = globalScaleRatio === null ? "hidden" : "auto"; scrollContainer.style.overflowY = "auto"; fixedWrapper.style.overflow = "hidden"; fixedWrapper.style.width = bounds.width * scale + "px"; @@ -284,37 +284,37 @@ if (BI.isIE()) { BI.Combo.prototype.adjustHeight = function (e) { adjustHeight.call(this, e); - var transformX = 0, transformY = 0; + var transformX = scrollContainer.scrollLeft; + var transformY = scrollContainer.scrollTop; if (this.popupView) { if (!checkInPopupView(this.popupView.element[0])) { - transformX = scrollContainer.scrollLeft; - transformY = scrollContainer.scrollTop; this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px"; this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale - transformY + "px"; } else { var cBounds = BI.extend({}, this.popupView.element[0].getBoundingClientRect()); var pBounds = BI.extend({}, this.popupView.element[0].parentElement.getBoundingClientRect()); + var hasScale = this.popupView.element[0].style.transform && this.popupView.element[0].style.transform.includes("scale"); var minWidth = parseInt(this.popupView.element[0].style.minWidth); var minHeight = parseInt(this.popupView.element[0].style.minHeight); cBounds.width = Math.max(cBounds.width, minWidth * scale); cBounds.height = Math.max(cBounds.height, minHeight * scale); - if (cBounds.left + cBounds.width - scrollContainer.scrollLeft> body.clientWidth * scale) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; + if ((cBounds.left * scale + cBounds.width * (hasScale ? 1 : scale)) - transformX > body.clientWidth) { + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px"; } else if (this.options.direction === "right") { - this.popupView.element[0].style.top = parseInt(pBounds.top) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(pBounds.right) - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.top) + "px"; + this.popupView.element[0].style.left = parseInt(pBounds.right) + "px"; } else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(pBounds.left) - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; + this.popupView.element[0].style.left = parseInt(pBounds.left) + "px"; }else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; this.popupView.element[0].style.left = parseInt(Math.min(pBounds.left, body.clientWidth - cBounds.width)) - transformX + "px"; } else { - this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px"; - this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px"; + this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px"; + this.popupView.element[0].style.left = parseInt(cBounds.left) * scale + "px"; } } this.popupView.element[0].style.transform = "scale(" + scale+ ")";