Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

def group(graph_or_primitive, builder, opts \\ []) has no function definition for primitive #27

Open
tcoopman opened this issue Sep 9, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@tcoopman
Copy link
Contributor

tcoopman commented Sep 9, 2018

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) and rrect can only take a Primitive of round_rect not group.
  • First deleting the old Primitive with Graph.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 the main graph, but Graph.add expects a primitive so this doesn't work
  • using Graph.map, but this action also passes a Primitive

I'm probably missing something here, but I'm still struggling with it, and that's the reason I stumbled on this issue.

@boydm
Copy link
Collaborator

boydm commented Sep 10, 2018

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.

@boydm boydm self-assigned this Sep 10, 2018
@boydm boydm added the enhancement New feature or request label Sep 10, 2018
@tcoopman
Copy link
Contributor Author

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.

@cboebel
Copy link

cboebel commented Feb 11, 2019

I have gotten around this - for now - by replaing the whole group. Not ideal but it works and its pretty quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants