Skip to content

Commit

Permalink
fix(player): popper align offset direction is reversed
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Oct 9, 2023
1 parent a788917 commit 39fd92c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vidstack/src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ export function autoPlacement(
setStyle(el, 'visibility', !trigger ? 'hidden' : null);
if (!trigger) return;

const negate = (v: string) => (placement.includes('top') ? `calc(-1 * ${v})` : v);
const negateY = (y: string) => (placement.includes('top') ? `calc(-1 * ${y})` : y);

return autoUpdate(trigger, el, () => {
computePosition(trigger, el, { placement: floatingPlacement, ...options }).then(({ x, y }) => {
Object.assign(el.style, {
top: `calc(${y + 'px'} + ${negate(
top: `calc(${y + 'px'} + ${negateY(
yOffset ? yOffset + 'px' : `var(--${offsetVarName}-y-offset, 0px)`,
)})`,
left: `calc(${x + 'px'} + ${negate(
xOffset ? xOffset + 'px' : `var(--${offsetVarName}-x-offset, 0px)`,
)})`,
left: `calc(${x + 'px'} + ${
xOffset ? xOffset + 'px' : `var(--${offsetVarName}-x-offset, 0px)`
}`,
});
});
});
Expand Down

0 comments on commit 39fd92c

Please sign in to comment.