修 top lest 值可能为 NaN 的情况

This commit is contained in:
2betop 2020-05-11 17:21:12 +08:00
parent 1bd1b43ef5
commit 3967971f3c
1 changed files with 6 additions and 2 deletions

View File

@ -152,8 +152,12 @@ export function calculatePosition(
const clip = container.getBoundingClientRect();
const clip2 = overlayNode.getBoundingClientRect();
const scaleX = clip2.width / overlayNode.offsetWidth;
const scaleY = clip2.height / overlayNode.offsetHeight;
const scaleX = overlayNode.offsetWidth
? clip2.width / overlayNode.offsetWidth
: 1;
const scaleY = overlayNode.offsetHeight
? clip2.height / overlayNode.offsetHeight
: 1;
// auto 尝试四个方向对齐。
placement =