const (
OverlayBottom OverlaySide = iota
OverlayTop
OverlayRight
OverlayLeft
)类型 OverlaySide
API 文档由 Go 源码生成,内容为英文。
type OverlaySide uint8OverlaySide is the edge of an anchor an overlay opens on.
常量
构造函数
PlaceOverlay#
func PlaceOverlay(anchor ui.Rect, size ui.Size, viewport ui.Rect, placement OverlayPlacement) (ui.Rect, OverlaySide)PlaceOverlay returns where an overlay of size goes beside anchor inside viewport, and the side it ended up on. It does what the Base UI positioner does on a collision: when the overlay does not fit on the requested side and fits better on the opposite one it flips, then it shifts along the edge and shrinks to stay inside the viewport less Margin. A menu opened at the pointer passes a zero-size anchor at the pointer with OverlayBottom and OverlayAlignStart, and so opens above it when there is no room below.