diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index cc9ed0f8d..66f4b3651 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -745,13 +745,14 @@ * 获取position:fixed相对定位的元素的clientRect */ getPositionRelativeContainingBlockRect: function (element) { - var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(element); - var rect = positionRelativeElement.getBoundingClientRect(); + const positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(element); + const { top, right, bottom, left, width, height, x, y } = positionRelativeElement.getBoundingClientRect(); + return { - ...rect.toJSON(), - scaleX: rect.width / positionRelativeElement.offsetWidth, - scaleY: rect.height / positionRelativeElement.offsetHeight + top, right, bottom, left, width, height, x, y, + scaleX: width / positionRelativeElement.offsetWidth, + scaleY: height / positionRelativeElement.offsetHeight, }; }, });