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

multiple classes with arrowheads not behaving correctly #1333

Closed
ddolan-lutron opened this issue May 17, 2023 · 3 comments · Fixed by #1362
Closed

multiple classes with arrowheads not behaving correctly #1333

ddolan-lutron opened this issue May 17, 2023 · 3 comments · Fixed by #1362
Labels
bug Something isn't working

Comments

@ddolan-lutron
Copy link

ddolan-lutron commented May 17, 2023

The D2 documentation calls out support for applying multiple classes to a single element, which is a quite useful feature. I've noticed that it is not supported for connectors. I had created classes to make it easier to apply cardinality to connectors in a class diagram, and I also wanted to create classes to apply formatting as to the type of association (e.g. Aggregation, Composition, Inheritance), but the array syntax is not supported for connectors, and attempting to apply multiple classes results in only the last class being applied. Being able to compose classes to create consistent connectors would be helpful, especially in the class diagram context.

Thanks for the young, but still great alternative to the existing field of diagrams-as-code tools!

@cyborg-ts cyborg-ts added this to D2 May 17, 2023
@alixander
Copy link
Collaborator

@ddolan-lutron
Copy link
Author

Thanks for the quick response! I must have either encountered the compiler error on an older version and have since updated, or I had a different syntax error and got confused by the error the compiler produced. I tried my use-case again and it does compile, but there are some cases where the settings don't compose as I might expect. In the example below, I have two classes that attempt to define different sub-properties of the target-arrowhead property, and the end result depends on the order in which the classes are specified.
image
image
This seemed a clean approach to what would otherwise be repetitive and verbose in a reasonably-sized diagram. The alternative is to create classes for all combinations of arrow shape and source and target cardinalities (which is my current solution).

@alixander
Copy link
Collaborator

alixander commented May 18, 2023

indeed, this looks like a bug with arrowhead nested within classes, thank you for surfacing this

@alixander alixander changed the title Feature Request: Apply multiple classes to connectors multiple classes with arrowheads not behaving correctly May 18, 2023
@alixander alixander added bug Something isn't working good first issue Good for newcomers and removed good first issue Good for newcomers labels May 18, 2023
@github-project-automation github-project-automation bot moved this to Done in D2 Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants