Skip to content

spaceUseStrategy

What is spaceUseStrategy?

The spaceUseStrategy attribute in cimdoc v4 controls how item space is allocated within a subpanel. To unlock this feature, a subpanel must have a stackDirection attribute.

Strategies

  • fill-remaining: Items expand to fill all available space in the container, sharing space according to their shares.
  • auto: Items are sized as specified in their width and height. If the width and height are missing, the item will be measured to determin the size.

Example

{
"version": "4",
"document": {
"panels": [
{
"width": "100mm",
"height": "100mm",
"items": [
{
"itemType": "subpanel",
"stackDirection": "horizontal",
"position": { "x": "0mm", "y": "0mm", "width": "100%", "height": "100%" }
"items": [
{
"id": "itemA",
"itemType": "rectangle",
"type": "shape",
"position": {
"width": "50%",
"height": "50%"
},
"color": "rgb(0, 0, 255)",
"spaceUseStrategy": {
"type": "auto"
}
},
{
"id": "itemB",
"itemType": "rectangle",
"type": "shape",
"position": {
"width": "50%",
"height": "50%"
},
"color": "rgb(255, 0, 0)",
"spaceUseStrategy": {
"type": "fill-remaining",
"shares": 1
}
}
]
}
]
}
]
}
}

TODO: iterate on example and show renders