Try Install Learn Blog API Packages GitHub
Pages
mint-ui

Search
Basic information
Entities
Versions
Dependencies
mint-color 0.9.0 <= v < 1.0.0

Ui.ImageCrop

A simple image cropping component.

States

position
:
Ui.ContainedImage
=
{ originalHeight: 0, originalWidth: 0, currentHeight: 0, currentWidth: 0, left: 0, top: 0 }

A state to hold the dimensions of the image.

status
=
Ui.ImageCrop.Status::Idle

The status.

Properties

embedded
:
Bool
=
false

Whether or not to embed the panel (removes border and padding).

onChange
:
Function(Ui.ImageCrop.Value, Promise(Void))
=
Promise.never1

The change event handler.

onUpdate
:
Function(Ui.ContainedImage, Promise(Void))
=
Promise.never1

Called when the position and size is updated.

size
:
Ui.Size
=
Ui.Size::Inherit

The size of the component.

value
:
Ui.ImageCrop.Value
=
{ source: "", height: 0.5, width: 0.5, x: 0.25, y: 0.25 }

The value (crop data).

Functions

calculateAxis
(
direction
:
Ui.ImageCrop.Direction
startPosition
:
Number
startSize
:
Number
distance
:
Number
)

Calculates the next position and size based on a direction for an axis.

handleKeyDown
(
event
:
Html.Event
)

Handles the keydown event.

moves
(
event
:
Html.Event
)
:
Promise(Void)

Handles the move event.

Renders the component.

startDrag
(
directions
:
Tuple(Ui.ImageCrop.Direction, Ui.ImageCrop.Direction)
event
:
Html.Event
)

Starts the drag.

updatePosition
(
value
:
Ui.ContainedImage
)

Updates the position of the image.

ups
(
event
:
Html.Event
)
:
Promise(Void)

Handles the up event.