d2 icon indicating copy to clipboard operation
d2 copied to clipboard

d2target: add support for cross arrowhead

Open MxHonesty opened this issue 1 year ago • 11 comments

Add support for cross arrowhead in d2target (and d2sketch).

closes #2028

Why i chose polygon In order to keep the look of the suggestion i went with a rotated polygon instead of simple crossing lines. Would appreciate feedback on this.

End-to-End Tests:

  • Added a new test case for CrossArrowhead in e2etests/stable_test.go.
  • Created test data for CrossArrowhead in e2etests/testdata/files/cross_arrowhead.d2.
  • Added expected output for CrossArrowhead tests in e2etests/testdata/txtar/sketch-cross-arrowhead/dagre/board.exp.json and e2etests/testdata/txtar/sketch-cross-arrowhead/elk/board.exp.json.
  • Included CrossArrowhead in the e2etests/txtar.txt file.

Images

normal sketch

MxHonesty avatar Nov 04 '24 23:11 MxHonesty

excellent! @MxHonesty @alixander

the japanese are unique. most Japanese read the following. '◯' means 'OK', 'correct', 'true', 'pass' and so on. 'x' means 'NG', 'wrong', 'false', 'fail' ...

e.g.

source-arrowhead: OK {
shape: circle
style.filled: false
}

target-arrowhead: NG {
shape: cross
}

what is better for non-Japanese? looking to the future, there are three patterns.

image

bo-ku-ra avatar Nov 05 '24 11:11 bo-ku-ra

@bo-ku-ra Good insight, X has distinct meaning. I think the O for ✅ and X for 🚫 is pretty common. In which case * is different from X.

How did you get that screenshot from Mermaid? What's the code for it?

alixander avatar Nov 05 '24 15:11 alixander

@alixander

How did you get that screenshot from Mermaid? What's the code for it?

https://github.com/terrastruct/d2/issues/2028#issue-2435421509 image

bo-ku-ra avatar Nov 05 '24 20:11 bo-ku-ra

I think the O for ✅ and X for 🚫 is pretty common.

yes, i agree.

surprisingly, '✅' is the same as 'x' in japan. 'x' and '✅' means 'NG', 'wrong', 'false', 'fail' ...

e.x. do you know DORAEMON?

image

bo-ku-ra avatar Nov 05 '24 20:11 bo-ku-ra

Hah, interesting.

Well in any case, I think D2's cross should be a true X shape.

E.g. the sketch version looks right

Screenshot 2024-11-05 at 3 01 25 PM

but the non-sketch version looks like a snowflake

Screenshot 2024-11-05 at 3 01 28 PM

@MxHonesty could you investigate that in this PR? I think the circle is an example of where the connection path doesn't extend all the way, instead stopping at the arrowhead shape.

alixander avatar Nov 05 '24 22:11 alixander

Sure, i will try doing it this way!

MxHonesty avatar Nov 06 '24 20:11 MxHonesty

hi @MxHonesty just wanted to check if you're still interested in pursuing this. No obligation of course, I can carry on what you have already if not.

alixander avatar Dec 06 '24 11:12 alixander

hi @alixander sorry for the inactivity. i had some busy weeks but was actually planning on picking up this work again this weekend if that's okay with you

MxHonesty avatar Dec 06 '24 19:12 MxHonesty

@MxHonesty No worries at all

alixander avatar Dec 06 '24 19:12 alixander

unfortunately canceled?

bo-ku-ra avatar Feb 25 '25 01:02 bo-ku-ra

I'll pick this back up before next release

alixander avatar Feb 25 '25 15:02 alixander

forgot?

bo-ku-ra avatar May 02 '25 14:05 bo-ku-ra

it's a lot of code changes required to hide that line that extends past the cross intersection unfortunately. We'll release v1 of it as this type of cross, and if there's sufficient demand, update it

alixander avatar May 15 '25 03:05 alixander