UNPKG

zent

Version:

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

20 lines (19 loc) 785 B
import { prefix } from './prefix'; import getViewportSize from '../../utils/dom/getViewportSize'; import measureScrollbar from '../../utils/dom/measureScrollbar'; export var BottomLeftInViewport = function (_a) { var relativeRect = _a.relativeRect, anchorRect = _a.anchorRect, contentRect = _a.contentRect, cushion = _a.cushion; var left = relativeRect.left, bottom = relativeRect.bottom; var x = left; var y = bottom + cushion; var viewport = getViewportSize(); var offsetWidth = contentRect.width - (viewport.width - anchorRect.left); return { style: { position: 'absolute', left: x - offsetWidth - measureScrollbar(), top: y, }, className: prefix('position-bottom-left-in-viewport'), }; };