Plushie.Canvas.Line (Plushie v0.7.0)

Copy Markdown View Source

Canvas line element between two points with optional stroke and opacity.

Summary

Functions

Converts this widget struct to a ui_node() map.

Creates a new element without an explicit ID (auto-assigned by parent container).

Creates a new element with the given ID, positional args, and keyword options.

Opacity from 0.0 to 1.0.

Stroke descriptor.

Returns the element type string for the wire protocol.

Applies keyword options to an existing widget struct.

Start X in pixels.

End X in pixels.

Start Y in pixels.

End Y in pixels.

Types

option()

@type option() ::
  (((({:x1, number()} | {:y1, number()}) | {:x2, number()}) | {:y2, number()})
   | {:stroke,
      %Plushie.Canvas.Stroke{
        cap: term(),
        color: term(),
        dash: term(),
        join: term(),
        width: term()
      }
      | keyword()
      | map()})
  | {:opacity, number()}

t()

Functions

build(widget)

@spec build(widget :: t()) :: Plushie.Widget.ui_node()

Converts this widget struct to a ui_node() map.

new(x1, y1, x2, y2)

new(id, x1, y1, x2, y2)

Creates a new element without an explicit ID (auto-assigned by parent container).

new(id, x1, y1, x2, y2, opts)

Creates a new element with the given ID, positional args, and keyword options.

opacity(widget, descriptor)

@spec opacity(widget :: t(), value :: number() | nil) :: t()

Opacity from 0.0 to 1.0.

Accepts number().

stroke(widget, descriptor)

@spec stroke(
  widget :: t(),
  value ::
    (%Plushie.Canvas.Stroke{
       cap: term(),
       color: term(),
       dash: term(),
       join: term(),
       width: term()
     }
     | keyword()
     | map())
    | nil
) :: t()

Stroke descriptor.

Accepts %Plushie.Canvas.Stroke{}.

type_name()

@spec type_name() :: String.t()

Returns the element type string for the wire protocol.

with_options(widget, opts)

@spec with_options(widget :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing widget struct.

x1(widget, descriptor)

@spec x1(widget :: t(), value :: number() | nil) :: t()

Start X in pixels.

Accepts number().

x2(widget, descriptor)

@spec x2(widget :: t(), value :: number() | nil) :: t()

End X in pixels.

Accepts number().

y1(widget, descriptor)

@spec y1(widget :: t(), value :: number() | nil) :: t()

Start Y in pixels.

Accepts number().

y2(widget, descriptor)

@spec y2(widget :: t(), value :: number() | nil) :: t()

End Y in pixels.

Accepts number().