fix(popover): update animation origin in RTL/MD (#17645)

Original main-axis origin fix was flawed in case of RTL.
Invert the animation’s main-axis origin in case the popover’s position is adjusted.

references #17012
This commit is contained in:
Abdelaziz Bennouna
2019-03-15 22:18:06 +00:00
committed by Brandy Carney
parent 9c48fa715d
commit 617453ba43

View File

@ -47,12 +47,19 @@ export function mdEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev?
// exceeds the body width it is off screen to the right so adjust
if (popoverCSS.left < POPOVER_MD_BODY_PADDING) {
popoverCSS.left = POPOVER_MD_BODY_PADDING;
// Same origin in this case for both LTR & RTL
// Note: in LTR, originX is already 'left'
originX = 'left';
} else if (
contentWidth + POPOVER_MD_BODY_PADDING + popoverCSS.left >
bodyWidth
) {
popoverCSS.left = bodyWidth - contentWidth - POPOVER_MD_BODY_PADDING;
originX = isRTL ? 'left' : 'right';
// Same origin in this case for both LTR & RTL
// Note: in RTL, originX is already 'right'
originX = 'right';
}
// If the popover when popped down stretches past bottom of screen,