kieler/klayjs

Minimum size for node with children

mgax opened this issue · 3 comments

mgax commented

A node in my graph has children, and I'd like to specify a minimum size for it, even if the children layout would allow it to be smaller. I've tried to specify the minWidth and minHeight properties but this results in an error.

Here is a minimal example: https://gist.github.com/mgax/198dca5dc60b5e5fc156 (on the left is the original graph; on the right is the output of KLayJS)

The two properties are forgotten during parsing in the js version. I'll take care of it.

Should work with version 0.3.2 now.
minWidth and minHeight have to be specified as properties. Also, the sizeConstraint has to be set such that the algorithm actually evaluates the minimum dimensions.

{
  width: 120,
  height: 190,
  children: [{
      id: "a",
      properties: {
        minWidth: 80,
        minHeight: 80,
        sizeConstraint: "MINIMUM_SIZE"
      },
      width: 80,
      height: 80,
      x: 10,
      y: 10,
      children: [{
        id: "b",
        width: 20,
        height: 20,
        x: 10,
        y: 10
      }]
    }, {
      id: "c",
      width: 80,
      height: 80,
      x: 10,
      y: 100
    }
  ]
}
mgax commented

That worked, thank you very much!