Skip to main content

EdgeInsets

Utility class to express insets (padding).

class EdgeInsets

Constructors

All Sides

constructor(_ length: Float)

Symmetrical inset on all sides.

_ length: Float

Inset length in pixels.


Horizontal & Vertical

constructor(horizontal: Float = 0.0, vertical: Float = 0.0)

Symmetrical inset for left/right and top/bottom.

horizontal: Float = 0.0

Left and right inset.

vertical: Float = 0.0

Top and bottom inset.


Per Edge

constructor(left: Float = 0.0, right: Float = 0.0, top: Float = 0.0, bottom: Float = 0.0)

Custom insets for each side.

left: Float = 0.0

Left inset.

right: Float = 0.0

Right inset.

top: Float = 0.0

Top inset.

bottom: Float = 0.0

Bottom inset.

Properties

horizontal

horizontal: Float { get set }

Sets both left and right to the given value. When read returns the sum of left and right.


vertical

vertical: Float { get set }

Sets both top and bottom to the given value. When read returns the sum of top and bottom.


left

left: Float { get set }

Left inset.


right: Float { get set }

Right inset.


top

top: Float { get set }

Top inset.


bottom

bottom: Float { get set }

Bottom inset.

Methods

copy

copy() -> (EdgeInsets)

Returns a copy.


overriding

overriding(_ modify: (EdgeInsets) -> ()) -> (EdgeInsets)

Returns a modified version of the insets. Modify the copy inside the modify funtion.

import { EdgeInsets } from kontakt_controls

var modified = (EdgeInsets(10)).overriding(fun (insets) {
insets.left = 40
})