Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Absolute vs. Relative Positioning #17

Open
joshpoll opened this issue Oct 20, 2023 · 1 comment
Open

Absolute vs. Relative Positioning #17

joshpoll opened this issue Oct 20, 2023 · 1 comment

Comments

@joshpoll
Copy link
Contributor

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

  • maybe set absolute positions?
  • maybe treated as an offset from the row's positioning?

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
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant