Skip to content

Commit

Permalink
feat(Overylay): fix overlay position error
Browse files Browse the repository at this point in the history
  • Loading branch information
tao1991123 committed Dec 3, 2018
1 parent d33f4af commit e5630de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/overlay/utils/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class Position {

offset.top += parseFloat(dom.getStyle(parent, 'border-top-width'), 10);
offset.left += parseFloat(dom.getStyle(parent, 'border-left-width'), 10);

offset.offsetParent = parent;
return offset;
}

Expand Down Expand Up @@ -288,9 +288,10 @@ export default class Position {
}

// transfer {left,top} equaly to {right,top}
const {width: viewportWidth} = _getViewportSize();
const pinElementParentOffset = this._getParentOffset(pinElement);
const {width: offsetParentWidth} = _getElementRect(pinElementParentOffset.offsetParent);
const {width} = _getElementRect(pinElement);
const right = viewportWidth - (left + width);
const right = offsetParentWidth - (left + width);
dom.setStyle(pinElement, {
left: "auto",
right: `${right + offset[0]}px`,
Expand Down

0 comments on commit e5630de

Please sign in to comment.