Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement flex layout #21

Open
xiaoiver opened this issue Dec 27, 2024 · 0 comments
Open

Implement flex layout #21

xiaoiver opened this issue Dec 27, 2024 · 0 comments
Assignees

Comments

@xiaoiver
Copy link
Owner

If we want to place a paragraph in a container, keeping it centered horizontally and vertically:

const container = new Rect({
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  display: 'flex',
  alignItems: 'center',
  justifyContent: 'center'
});
const paragraph = new Text({
  content: 'Line 1 \n Line 2 \n Line 3',
});

container.appendChild(paragraph);

So we need the help of layout engine such as Yoga.

Other flex layout implementations:

@xiaoiver xiaoiver converted this from a draft issue Dec 27, 2024
@xiaoiver xiaoiver self-assigned this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant