enum Eagle::Anchor

Overview

Where a control sits inside its parent when no container is arranging it. margin offsets it from that spot, and Fill stretches it to the parent's size minus the margins.

pause = Panel.new(size: v2(300, 200))
pause.anchor = Anchor::Center            # stays centered when the window resizes

hud_score = Label.new("0")
hud_score.anchor = Anchor::TopRight
hud_score.margin = Vec4.new(-10, 10, 0, 0) # 10 px in from the corner

Defined in:

eagle/ui/control.cr

Enum Members

TopLeft = 0
Top = 1
TopRight = 2
Left = 3
Center = 4
Right = 5
BottomLeft = 6
Bottom = 7
BottomRight = 8
Fill = 9

Stretch to fill the parent, minus margins.

Instance Method Summary

Instance Method Detail

def bottom? #

Returns true if this enum value equals Bottom


def bottom_left? #

Returns true if this enum value equals BottomLeft


def bottom_right? #

Returns true if this enum value equals BottomRight


def center? #

Returns true if this enum value equals Center


def factors : Vec2 #

Where the anchor sits as fractions of the parent size: (0, 0) is top-left and (1, 1) bottom-right.


def fill? #

Returns true if this enum value equals Fill


def left? #

Returns true if this enum value equals Left


def right? #

Returns true if this enum value equals Right


def top? #

Returns true if this enum value equals Top


def top_left? #

Returns true if this enum value equals TopLeft


def top_right? #

Returns true if this enum value equals TopRight