scenic
scenic copied to clipboard
def group(graph_or_primitive, builder, opts \\ []) has no function definition for primitive
other functions with the same argument graph_or_primitive
also have a definition with a Primitive
struct, but it seems this is not implemented for group.
I'm not sure if group should not expect a primitive or if it's just not implemented?
Next to stating the issue, I'm also adding my problem here. I'm trying to use Graph.modify to update a complete group but I have no idea how to do it.
This is some simplified code:
Graph.build()
|> ....
|> group(
fn g -> builds_many(g), id: :sample
)
def builds_many(g) do
g
|> rrect(...)
end
And on an update I want to basically replace the group sample
by doing builds_many
again.
These are the things I tried:
- Using
Graph.modify
, but this has the problem that I get a primitive (a group) andrrect
can only take a Primitive ofround_rect
not group. - First deleting the old
Primitive
withGraph.delete
, then building a new graph (It's not possible to just create a group from nothing), creating a new group and then try to add this graph to themain
graph, but Graph.add
expects a primitive so this doesn't work - using
Graph.map
, but this action also passes aPrimitive
I'm probably missing something here, but I'm still struggling with it, and that's the reason I stumbled on this issue.
Good issue. Requires a think.
Do you expect that you would need to re-declare everything in the group or simply add/delete things from it. The items in a group are ordered, so that matters.
For my use case, I would actually love to simply replace the complete group (or everything that's inside the group) but I'm not sure if this is the best for performance.
I have gotten around this - for now - by replaing the whole group. Not ideal but it works and its pretty quick.