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.
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:
The returned object now contains the non-leaf box with its own attributes x, y, width, height + leaf flag.