plushie/widget/canvas

Canvas widget builder. Layers are managed via extension commands.

Types

pub opaque type Canvas

Values

pub fn a11y(c: Canvas, a: a11y.A11y) -> Canvas

Set accessibility properties for this widget.

pub fn alt(c: Canvas, a: String) -> Canvas

Set the alt text for accessibility.

pub fn background(c: Canvas, col: color.Color) -> Canvas

Set the background color.

pub fn build(c: Canvas) -> node.Node

Build the canvas into a renderable Node.

pub fn description(c: Canvas, d: String) -> Canvas

Set the description text for accessibility.

pub fn event_rate(c: Canvas, rate: Int) -> Canvas

Set the event throttle rate in milliseconds.

pub fn interactive(c: Canvas, enabled: Bool) -> Canvas

Set whether the canvas accepts mouse events.

pub fn layer(
  c: Canvas,
  name: String,
  s: List(node.PropValue),
) -> Canvas

Add a single named layer to the canvas. Merges with existing layers.

pub fn layers(
  c: Canvas,
  l: dict.Dict(String, List(node.PropValue)),
) -> Canvas

Set all canvas layers as a dict of named shape lists.

pub fn new(
  id: String,
  width: length.Length,
  height: length.Length,
) -> Canvas

Create a new canvas builder.

pub fn on_move(c: Canvas, enabled: Bool) -> Canvas

Enable the move event.

pub fn on_press(c: Canvas, enabled: Bool) -> Canvas

Enable the press event.

pub fn on_release(c: Canvas, enabled: Bool) -> Canvas

Enable the release event.

pub fn on_scroll(c: Canvas, enabled: Bool) -> Canvas

Enable the scroll event.

pub fn shapes(c: Canvas, s: List(node.PropValue)) -> Canvas

Set the shape list for the default layer.

Search Document