Resize only expanded group

Hi,

I need to resize group of nodes, but only if the group is expanded.
When I set resizable to true, I can resize the group expanded or packed. But when I resize expanded group and then pack it, it remain in expanded size.
Also I dont want to allow user to change size of packed group.

Thank you for responses.

I think you want to bind Part.resizable to the value of Group.isSubGraphExpanded:

  $(go.Group, . . .,
    new go.Binding("resizable", "isSubGraphExpanded").ofObject(),
    . . .
  )

Thank you!

Now user cant change size of packed group. But if size of expanded group changed and then group is packed, It will remain in size of expanded group, but I want to go back to default size.

You can reset the group’s size in a subGraphExpandedChanged function:

subGraphExpandedChanged: function(group) {
  if (!group.isSubGraphExpanded) {
    group.desiredSize = new go.Size(NaN, NaN);
  }
}