getMainAxisFlip
获取主轴翻转后的 Placement。
函数签名
typescript
function getMainAxisFlip(placement: Placement): Placement
type Placement =
| 'top' | 'top-start' | 'top-end'
| 'bottom' | 'bottom-start' | 'bottom-end'
| 'left' | 'left-start' | 'left-end'
| 'right' | 'right-start' | 'right-end'参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
placement | Placement | 是 | 原始定位方式 |
返回值
| 类型 | 说明 |
|---|---|
Placement | 主轴翻转后的定位方式 |
工作原理
根据基础方向和对齐方式,计算主轴翻转后的 Placement:
top-start↔top-endbottom-start↔bottom-endleft-start↔left-endright-start↔right-end
用于弹出层位置调整,当原始位置超出视口时自动翻转对齐方式。