Skip to content

Commit

Permalink
docs(Overlay): add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Jul 10, 2019
1 parent d00329f commit 4430796
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/overlay/utils/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,14 @@ export default class Position {
// Detecting element is in the window, we want to adjust position later.
_isInViewport(element) {
const viewportSize = _getViewportSize();
// Avoid animate problem that use offsetWidth instead of getBoundingClientRect.
// const elementRect = _getElementRect(element);
const elementRect = element.getBoundingClientRect();

// Avoid animate problem that use offsetWidth instead of getBoundingClientRect.
return (
elementRect.left >= 0 &&
// using strict < instead of <=, to handle the bug of container expaned on element placement
// closing https://github.com/alibaba-fusion/next/issues/853
elementRect.left + element.offsetWidth < viewportSize.width &&
elementRect.top >= 0 &&
elementRect.top + element.offsetHeight < viewportSize.height
Expand Down

0 comments on commit 4430796

Please sign in to comment.