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

d2renderer: #384 The arrowhead crow feet variants #578

Merged

Conversation

martinjirku
Copy link
Contributor

@martinjirku martinjirku commented Dec 31, 2022

Introduce new styles for arrowheads #384:

  • crows-foot-many-required
  • crows-foot-many-optional
  • crows-foot-one-required
  • crows-foot-one-optional

Open questions

I do not like crows-foot-* repeated 4 times, but it seems the simplest way to implement this, though d2 DSL for crows-foot is not the best DX.

Screenshots

This SVG:
foot

is generated by this d2:

a <-> b: crows-foot-many-optional {
  source-arrowhead: {
    shape: crows-foot-many-optional
  }
  target-arrowhead: {
    shape: crows-foot-many-optional
  }
}

c <--> d: crows-foot-many-required {
  source-arrowhead: {
    shape: crows-foot-many-required
  }
  target-arrowhead: {
    shape: crows-foot-many-required
  }
}

e <--> f: crows-foot-one-required {
  source-arrowhead: {
    shape: crows-foot-one-required
  }
  target-arrowhead: {
    shape: crows-foot-one-required
  }
}

g <--> h: crows-foot-one-optional {
  source-arrowhead: {
    shape: crows-foot-one-optional
  }
  target-arrowhead: {
    shape: crows-foot-one-optional
  }
}

@martinjirku martinjirku changed the title TODO: d2renderer: #384 The arrowhead crow feet variants d2renderer: #384 The arrowhead crow feet variants Dec 31, 2022
Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! these look great!

can you an e2e test to https://github.com/terrastruct/d2/blob/master/e2etests/stable_test.go?

i wonder if we can just remove the "crows-foot" to these names. and also the omission of "required" to signify optional.

many
many-required
one
one-required

any thoughts? i need to do some research to see if this is ambiguous, like if there's other symbols that people would expect with these keywords.

@alixander
Copy link
Collaborator

or maybe cf for shorthand? cf-one

@martinjirku
Copy link
Contributor Author

cf-one | cf-many | cf-many-required | cf-one-required is definitely less to write. I am always afraid of abbreviations, but if it will be well documented, then it could be OK.

@alixander
Copy link
Collaborator

let's go with that then

@alixander
Copy link
Collaborator

alixander commented Dec 31, 2022

@martinjirku could you sign your commits please? we have this requirement turned on in our org: #557 (comment) .

i'll make sure to document this (#580)

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinjirku martinjirku force-pushed the d2-384-crows-feet-arrowhead branch 2 times, most recently from 0009469 to 516580d Compare December 31, 2022 17:32
Introduce new styles for arrowhead:
  - crows-feet-many-required
  - crows-feet-many-optional
  - crows-feet-one-required
  - crows-feet-one-optional
@martinjirku martinjirku force-pushed the d2-384-crows-feet-arrowhead branch from b8db08f to 2bff170 Compare December 31, 2022 18:04
@martinjirku
Copy link
Contributor Author

Finally, I've successfully signed my previous commits. Can you re-check?

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g <--> h: {
  source-arrowhead: {
    shape: cf-one
  }
  target-arrowhead: {
    shape: cf-one
  }
}
h -> e -> a: {
  target-arrowhead: {
    shape:cf-many
  }
}
g -> e -> a: {
  target-arrowhead: {
    shape:cf-many-required
  }
}

Screen Shot 2022-12-31 at 10 23 52 AM

  1. The cf-many looks slightly off (black circle).
  2. Also when the arrows approach at an angle, the crows feet don't match up to the border (red).

(1) should be fixed here, but i'm not sure what to do about (2). To extend these at an angle would also look weird. I'd say it's acceptable for now.

@alixander
Copy link
Collaborator

alixander commented Dec 31, 2022

Screen Shot 2022-12-31 at 10 28 09 AM

hmm actually i just noticed it's also off for other shapes too. this might be tricky to solve, you'd have to basically curve the crows foot too. i'll just put an issue to track. this PR doesn't need to address that

#581

@martinjirku
Copy link
Contributor Author

  1. The cf-many looks slightly off (black circle).
  2. Also when the arrows approach at an angle, the crows feet don't match up to the border (red).

(1) should be fixed here, but i'm not sure what to do about (2). To extend these at an angle would also look weird. I'd say it's acceptable for now.

Is this acceptable as solution for (1)?
image

@alixander
Copy link
Collaborator

nice, yeah that's a good solution for now

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! is this ready to merge?

@martinjirku
Copy link
Contributor Author

awesome! is this ready to merge?

Yes, ready to go 🚀

@alixander alixander merged commit be6c3a1 into terrastruct:master Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants