UNPKG

zent

Version:

一套前端设计语言和基于React的实现

27 lines (23 loc) 621 B
import createPlacement from './create'; /** * ---------------------- * | |---------- * | anchor | popover | * |--------------------|--------- * */ export default createPlacement((anchorBoundingBox, containerBoundingBox, contentDimension, options) => { const { right, bottom } = anchorBoundingBox; const x = right + options.cushion; const y = bottom - contentDimension.height; return { getCSSStyle() { return { position: 'absolute', left: `${Math.round(x)}px`, top: `${Math.round(y)}px` }; }, name: 'position-right-bottom' }; });