Module elmesque::element [] [src]

Ported from elm-lang's Graphics.Element module

Graphical elements that snap together to build complex widgets and layouts.

Each element is a rectangle with a known width and height, making them easy to combine and position.

Images

image, fitted_image, cropped_image, tiled_image

Styling

width, height, size, color, opacity

Inspection

width_of, height_of, size_of

Layout

flow, up, down, left, right, inward, outward

Layout Aliases

There are some convenience functions for working with flow in specific cases:

layers, above, below, beside

Positioning

empty, spacer, container

Specific Positions

To create a Position you can use any of the built-in positions which cover nine common positions:

middle, mid_top, mid_bottom, mid_left, mid_right, top_left, top_right, bottom_left, bottom_right

If you need more precision, you can create custom positions:

absolute, relative, middle_at, mid_top_at, mid_bottom_at, mid_left_at, mid_right_at, top_left_at, top_right_at, bottom_left_at, bottom_right_at

Structs

Element

Graphical elements that snap together to build complex widgets and layouts.

Position

An element's Position.

Properties

An Element's Properties.

Renderer

CUSTOM NON-ELM FUNCTIONS

Enums

Direction

The direction for a flow of Elements.

ImageStyle

Styling for the Image Element.

Pos
Prim

The various kinds of Elements.

Three

Functions

absolute

Repetitive things.

bottom_left
bottom_left_at
bottom_right
bottom_right_at
cropped_image

Create a cropped image. Take a rectangle out of the picture starting at the given top left coordinate.

down
draw_element

Draw an Element.

empty

An Element that takes up no space. Good for things that appear conditionally.

fitted_image

Create a fitted image given a width, height and texture. This will crop the picture to best fill the given dimensions.

flow

Have a list of elements flow in a particular direction. The Direction starts from the first element in the list. The result is an Element.

image

Create an image given a width, height and texture.

inward
layers

Layer elements on top of each other, starting from the bottom.

left
mid_bottom
mid_bottom_at
mid_left
mid_left_at
mid_right
mid_right_at
mid_top
mid_top_at
middle
middle_at
new_element

Construct a new Element from width, height and some Prim. Iterates the global GUID counter by one and returns that as the Element id.

outward
relative
right
size_of

Return the size of the Element.

spacer

Create an empty box. this is useful for getting your spacing right and making borders.

tiled_image

Create a tiled image given a width, height and texture.

top_left
top_left_at
top_right
top_right_at
up