AND states controlled by concurrency lines
A proposal for laying out the AND states is to have the immediate children expanded to fit the region bounded by the nearby concurrency lines. Similarly, if the child is too big, the parent should be expanded.
Resizing child states is done by moving the inner concurrency lines and as the immediate siblings fit the region they are placed in, they would end up resizing.
Concurrency lines should be axis aligned as diagonal lines are a waste of space anyways this should be no concern but fixing the lines to be orthogonal allow for optimizations with the calculations.
Moving a line can be done by grabbing and dragging along the cross axis. This operation will resize siblings to the line.
Moving the endpoint of a line (which should always remain visually fixed to the edges of the state) will move the entire line without resizing as this operation can split a state.
Looking at the pstate examples there were no cases where a single concurrent state was split both ways so handling only concurrent lines that meet the edges should be fine. This includes intersections but it doesn't seem necessary to support a line that goes from edge to concurrency line or between concurrency lines. Possible stretch goal is to include these.
Additionally, concurrent states should have no less than 1 concurrency line to ensure that it is always clear that the state has the AND type.
Implementation considerations
When moving a state into a bounded region the state may visually resize but should not change sizes until actually dropped into the region. Another editor had a similar issue where pushing elements intermediately out of the way left them there despite the intention of the action dictating it was a temporary move.
A bigger issue is the ability to save and restore state during a move operation that could damage the original temporarily.
Invalid state configurations
In the case where >= 2 states share the same region they will share (either vertically or horizontally) the space evenly depending on if the space is taller than wide.
Splitting a state with a new line (or moving the endpoints of an existing one) should shrink the state to the box in which it already covers the most area of.
Ex. Let the i
be the new concurrency line, the state would shrink to the left as most of the area is to the left of the line.
-----------------
| |-----i-| |
| | i | |
| | i | |
| |-----i-| |
-----------------