bluefishjs / bluefish-archive

A SolidJS diagramming framework
https://bluefishjs.org
MIT License
75 stars 4 forks source link

Absolute vs. Relative Positioning #17

Open joshpoll opened 1 year ago

joshpoll commented 1 year ago

What should the behavior be when children of a Row have positions?

I think these two specs should be equivalent:

<Row>
  <Circle cx={5} cy={10} ... />
</Row>
<Circle id="circle" cx={5} cy={10} ... />
<Row>
  <Ref refId="circle" />
</Row>

This suggests that the Circle's position should be set before it is read by the Row to be consistent. But actually this is not quite right, since Row can translate its children around. Maybe instead we can have

<Row positioning="absolute">
  <Circle cx={5} cy={10} ... />
</Row>

This would probably set the translation of the Row to 0 to match the behavior of lazy materialization. We could also think of it as removing that coordinate system entirely. But this introduces additional complexity in the Ref version where the difference in positioning modes doesn't really make sense, since it's always absolute.

SwiftUI doesn't seem to do anything sensible in these cases, so it's hard to look there for answers.

joshpoll commented 1 year ago

A simple option could just be to expose a translation field, but it's not clear how that would compose with x and y fields on e.g. Row. Another option could be to rename positioning to coordinates or coordinateFrame.