type

Insets

src @Js
@Serializable { simple=true }
const class Insets : Obj

Insets represents spacing around the edge of a rectangle.

constructors

fromStr

Parse from comma or space separated string using CSS format

make

Construct with top, and optional right, bottom, left.

fields

bottom

Bottom side spacing

defVal

Default instance 0, 0, 0, 0.

left

Left side spacing

right

Right side spacing

top

Top side spacing

methods

equals

Return if obj is same Insets value.

h

Top plus bottom

hash

Return hash of top, right, bottom, left.

isNone

Return if all sides are set to zero

toSize

Return right+left, top+bottom

toStr

If all four sides are equal return "len" otherwise return "top right bottom left".

w

Left plus right

Slot Details

bottom

src const Float bottom

Bottom side spacing

defVal

src const static Insets defVal := ...

Default instance 0, 0, 0, 0.

equals

src virtual override Bool equals(Obj? obj)

Return if obj is same Insets value.

fromStr

src static new fromStr(Str s, Bool checked := true)

Parse from comma or space separated string using CSS format:

  • "top"
  • "top, right" (implies bottom = top, left = right)
  • "top, right, bottom" (implies left = right)
  • "top, right, bottom, left"

h

src Float h()

Top plus bottom

hash

src virtual override Int hash()

Return hash of top, right, bottom, left.

isNone

src Bool isNone()

Return if all sides are set to zero

left

src const Float left

Left side spacing

make

src new make(Num top, Num? right := null, Num? bottom := null, Num? left := null)

Construct with top, and optional right, bottom, left. If one side is not specified, it is reflected from the opposite side:

Insets(5)     => Insets(5,5,5,5)
Insets(5,6)   => Insets(5,6,5,6)
Insets(5,6,7) => Insets(5,6,7,6)

src const Float right

Right side spacing

toSize

src Size toSize()

Return right+left, top+bottom

toStr

src virtual override Str toStr()

If all four sides are equal return "len" otherwise return "top right bottom left".

top

src const Float top

Top side spacing

w

src Float w()

Left plus right