varkor / tangle

A modern string diagram editor for the web.
https://varkor.github.io/tangle/?c=F5A3A3,F5CCA3,F5F5A3,CCF5A3,A3F5A3,A3F5CC,A3F5F5,A3CCF5,A3A3F5,CCA3F5,F5A3F5,F5A3CC
MIT License
19 stars 0 forks source link

Allow finer grained positioning #11

Open sjoerdvisscher opened 1 year ago

sjoerdvisscher commented 1 year ago

I would love to be able to position tiles on half coordinate points, so that f.e. in a case like this I can vertically center the right arrow.

varkor commented 1 year ago

Your link appears to be broken. (Note that you need to click "Save", or use the keyboard shortcut, to update the URL: it doesn't update automatically.)

sjoerdvisscher commented 1 year ago

D'oh, I thought I had checked that! This one then: https://varkor.github.io/tangle/?t=W1tbXV0sW1tbMSxbMCwxLDAsMV1dLFsxLFswLDAsMSwxXV0sWzAsW11dXSxbWzEsWzAsMSwwLDFdXSxbMSxbMSwxLDAsMV1dLFsxLFswLDEsMCwxXV1dXSxbWzAsMS41LDEsWyIiLDAsMV1dXV0=&c=F5A3A3,F5F5A3,A3CCF5

varkor commented 1 year ago

Ah, I see what you mean. It was actually a deliberate decision not to permit positioning like that, for several reasons. The first is that you eventually end up needing arbitrary positioning (e.g. consider a binary tree of arbitrary depth, where you need half-tile positioning at the first level, quarter-tile positioning at the second level, and so on). The second is that it is simpler to prove a formal correspondence between string diagrams and pasting diagrams when there is a fixed grid. The third is simply for aesthetic reasons (though I appreciate this one is subjective).

The intended approach to diagrams like the one you give is to make the cell wider, like this. I could potentially make it possible to scale a diagram in one direction to make it appear shorter, but I personally think the diagram looks good even with a height of 3 rather than 2.

sjoerdvisscher commented 1 year ago

I think the case of having a binary-like structure is not so common, but having an even number of arrows on one side and an odd number of arrows on the other side is very common. I could double the spacing of everything like f.e. this and that looks pretty good until you start adding annotations which then look tiny.

varkor commented 1 year ago

I think the case of having a binary-like structure is not so common, but having an even number of arrows on one side and an odd number of arrows on the other side is very common.

I do agree this is not uncommon. I'm not sure what the ideal solution is yet – at the moment, I have simply been leaving empty spaces where appropriate to centre both sides (as in my earlier example), which works well enough for my purposes. When I have some time, I will think about whether there are more elegant solutions.