Scenic.Graph.modify

You're seeing just the function modify, go back to Scenic.Graph module for more information.
Link to this function

modify(graph, id, action)

View Source

Specs

modify(
  graph :: t(),
  id :: any() | (any() -> as_boolean(term())),
  action :: (any() -> Scenic.Primitive.t())
) :: t()

Modify one or more primitives in a graph.

Retrieves the primitive (or primitives) specified by id and passes them to a callback function. The result of the callback function is stored as the new version of that primitive in the graph.

If multiple primitives match the specified id, then each is passed, in turn, to the callback function.

The id can be either

  • a term to match against (fast)
  • a filter function that returns a boolean (slower)

Examples:

graph
|> Graph.modify( :explicit_id, &text("Updated Text 1") )
|> Graph.modify( {:id, 123}, &text("Updated Text 2") )
|> Graph.modify( &match?({:id,_},&1), &text("Updated Text 3") )