getModalPosition

Returns the position of a modal based on the specified options.

The options parameter specifies the desired position of the modal:

  • 'center': Positions the modal at the center of the screen.

  • 'topLeft': Positions the modal at the top left corner of the screen.

  • 'topRight': Positions the modal at the top right corner of the screen.

  • 'bottomLeft': Positions the modal at the bottom left corner of the screen.

  • 'bottomRight': Positions the modal at the bottom right corner of the screen.

The screenWidth and screenHeight parameters specify the screen dimensions. The modalWidth and modalHeight parameters specify the width and height of the modal.

Example usage:

val options = GetModalPositionOptions(
position = "center",
modalWidth = 200.0,
modalHeight = 100.0,
screenWidth = 800.0,
screenHeight = 600.0
)
val modalPosition = getModalPosition(options)

Returns a map containing the top and right positions of the modal. The top position is the distance from the top of the screen, and the right position is the distance from the right of the screen. The modal position is calculated based on the specified options and screen size. The modal width and height are used to center the modal on the screen. The modal is positioned at the top left, top right, bottom left, or bottom right corner of the screen. The modal is positioned at the center of the screen. The modal is positioned at the top right corner of the screen.