diagrams / diagrams-contrib

User-contributed extensions to diagrams
BSD 3-Clause "New" or "Revised" License
27 stars 30 forks source link

Tree rendering broken (or bad default for symmLayout) #30

Open jonashaag opened 10 years ago

jonashaag commented 10 years ago

Here's what is rendered using the default symmLayout (SVG) (code):

screen shot 2014-03-18 at 16 44 09

EDIT: Sorry, this shows seperators of 0.5, 1.5, 2.5, 3.5, 4.5, and 5.5. The default is 1, thus a mixture of the first and second trees in that picture.

This default should be so that it actually looks like a tree, not a bunch of nodes. In my case, it didn't even show more than one node because they all overlapped.

Btw, there seems to be something wrong with how a tree's envelope is calculated: When I annotate each of these trees using === ("some" # text), then this is the result (without the black line):

screen shot 2014-03-18 at 16 44 21 screen shot 2014-03-18 at 16 44 39

byorgey commented 10 years ago

Well, any default separation we pick is somewhat arbitrary. The default looked bad for you since you happened to use nodes with a width of 2 units. However, you do have a point that this is surprising behavior (and using radius-1 nodes is probably rather common). So I could see an argument for changing the default, maybe to 4? But better than that, perhaps we should add some sort of mode which takes the node sizes into account when deciding how big to draw the tree? I'm not exactly sure what the API for this should look like but I'm open to suggestions.

Can you say what exactly is wrong about the tree envelopes? What would you expect to see, and how is that different from what is actually rendered?