fix(popover): originate animation from right in RTL/MD (#17381)

This commit is contained in:
Abdelaziz Bennouna
2019-02-05 21:51:15 +01:00
committed by Liam DeBeasi
parent fc43faa86a
commit bc3aa21695

View File

@@ -4,8 +4,10 @@ import { Animation } from '../../../interface';
* Md Popover Enter Animation
*/
export function mdEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev?: Event): Promise<Animation> {
const isRTL = document.dir === 'rtl';
let originY = 'top';
let originX = 'left';
let originX = isRTL ? 'right' : 'left';
const contentEl = baseEl.querySelector('.popover-content') as HTMLElement;
const contentDimentions = contentEl.getBoundingClientRect();
@@ -24,7 +26,6 @@ export function mdEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev?
? targetDim.top
: bodyHeight / 2 - contentHeight / 2;
const isRTL = document.dir === 'rtl';
const targetLeft =
targetDim != null && 'left' in targetDim
? isRTL
@@ -49,7 +50,7 @@ export function mdEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev?
bodyWidth
) {
popoverCSS.left = bodyWidth - contentWidth - POPOVER_MD_BODY_PADDING;
originX = 'right';
originX = isRTL ? 'left' : 'right';
}
// If the popover when popped down stretches past bottom of screen,