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

Naming non-leaf boxes for later use #2

Open
AlainRo opened this issue Apr 23, 2018 · 1 comment
Open

Naming non-leaf boxes for later use #2

AlainRo opened this issue Apr 23, 2018 · 1 comment

Comments

@AlainRo
Copy link

AlainRo commented Apr 23, 2018

Very useful idea and code. Thanks.
I got several applications. One of them needs to "do something" with non-leaf boxes which do not really exist apart from their size.

I propose to optionally name them :
var layout = {orientation: "vertical", children: [...], size: 2, name: "myname"}

One line of code is enough to allow this:

  • 87 if (child.name) {result[child.name] = childBox; result[child.name].leaf= false;};

The returned object now contains the non-leaf box with its own attributes x, y, width, height + leaf flag.

@curran
Copy link
Member

curran commented Apr 23, 2018

Great idea! I'd be open to reviewing a pull request with this feature.

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

No branches or pull requests

2 participants