Skip to content

Commit

Permalink
fix(connected-position-strategy): wrong logic when determining whethe…
Browse files Browse the repository at this point in the history
…r element is on screen

Fixes some faulty logic, introduced in angular#2102, that meant that the overlay considers the viewport's scroll offset when determining how much it overflows on either side.

Fixes angular#2658.
  • Loading branch information
crisbeto committed Jan 16, 2017
1 parent 4ab6f30 commit d4ba706
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/core/overlay/position/connected-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ export class ConnectedPositionStrategy implements PositionStrategy {
let y = originPoint.y + overlayStartY + this._offsetY;

// How much the overlay would overflow at this position, on each side.
let leftOverflow = viewportRect.left - x;
let rightOverflow = (x + overlayRect.width) - viewportRect.right;
let topOverflow = viewportRect.top - y;
let bottomOverflow = (y + overlayRect.height) - viewportRect.bottom;
let leftOverflow = 0 - x;
let rightOverflow = (x + overlayRect.width) - viewportRect.width;
let topOverflow = 0 - y;
let bottomOverflow = (y + overlayRect.height) - viewportRect.height;

// Visible parts of the element on each axis.
let visibleWidth = this._subtractOverflows(overlayRect.width, leftOverflow, rightOverflow);
Expand Down

0 comments on commit d4ba706

Please sign in to comment.