Skip to content

Commit

Permalink
fix(Overlay): endless loop in position calculate
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Jul 9, 2019
1 parent 40de21d commit 5553799
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/overlay/utils/position.js
Expand Up @@ -353,12 +353,14 @@ export default class Position {
_isInViewport(element) {
const viewportSize = _getViewportSize();
// Avoid animate problem that use offsetWidth instead of getBoundingClientRect.
const elementRect = _getElementRect(element);
// const elementRect = _getElementRect(element);
const elementRect = element.getBoundingClientRect();

return (
elementRect.left >= 0 &&
elementRect.left + element.offsetWidth <= viewportSize.width &&
elementRect.left + element.offsetWidth < viewportSize.width &&
elementRect.top >= 0 &&
elementRect.top + element.offsetHeight <= viewportSize.height
elementRect.top + element.offsetHeight < viewportSize.height
);
}
// 鍦ㄨ繖閲屽仛RTL鍒ゆ柇 top-left 瀹氫綅杞寲涓虹瓑鏁堢殑 top-right瀹氫綅
Expand Down

0 comments on commit 5553799

Please sign in to comment.