compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Add ability to set the size of popup, which depends on the window bounds

Open igordmn opened this issue 4 years ago • 1 comments

We can add a new parameter:

Popup(
  popupSizeProvider: PopupSizeProvider
)

interface PopupSizeProvider {
    fun calculatePosition(
        anchorBounds: IntRect,
        windowSize: IntSize,
        layoutDirection: LayoutDirection,
        popupContentSize: IntSize
    ): IntSize
}

or maybe better PopupBoundsProvider:

interface PopupBoundsProvider {
    fun calculatePosition(
        anchorBounds: IntRect,
        windowSize: IntSize,
        layoutDirection: LayoutDirection,
        popupContentSize: IntSize
    ): IntRect
}

It will allow to place popup whenever we want. For example, we would can place dropdown menu above the component, if it can't be placed below the component.

Also, before we do that, it probably would be helpful, if we cover in docs, that constraints passed to Popup are equals the window size by default.

igordmn avatar Dec 01 '21 08:12 igordmn

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 16:08 okushnikov