Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/anchored-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export function getAnchoredPosition(
floatingElement.getBoundingClientRect(),
anchorElement instanceof Element ? anchorElement.getBoundingClientRect() : anchorElement,
getDefaultSettings(settings),
{width: window.innerWidth, height: window.innerHeight},
)
}

Expand Down Expand Up @@ -334,13 +335,15 @@ function getDefaultSettings(settings: Partial<PositionSettings> = {}): PositionS
* @param floatingRect WidthAndHeight for the floating element
* @param anchorRect BoxPosition for the anchor element
* @param PositionSettings to customize the calculated position for the floating element.
* @param visibleViewportSize Size of the visible viewport (window dimensions), used when displayInVisibleViewport is true
*/
function pureCalculateAnchoredPosition(
viewportRect: BoxPosition,
relativePosition: Position,
floatingRect: Size,
anchorRect: BoxPosition,
{side, align, allowOutOfBounds, anchorOffset, alignmentOffset, displayInVisibleViewport}: PositionSettings,
visibleViewportSize: Size,
): AnchorPosition {
// Compute the relative viewport rect, to bring it into the same coordinate space as `pos`
let effectiveViewportRect = viewportRect
Expand All @@ -350,8 +353,8 @@ function pureCalculateAnchoredPosition(
effectiveViewportRect = {
top: 0,
left: 0,
width: window.innerWidth,
height: window.innerHeight,
width: visibleViewportSize.width,
height: visibleViewportSize.height,
}
}

Expand Down
Loading