Using Placeholders in go.Group, So when a node is dropped into the group does automatically resize itself to surround its member nodes. I want to be able to get the size of the group while automatically resizing it.So how do I get the size of group?
The GraphObject.actualBounds will include the size of a Group or its Group.placeholder.
What do you mean by “while automatically resizing it”?
So even if I use placeholder, can I get the group size by binding actualBounds?
No, probably not. I still don’t understand what your question really is. Since I’m not sure what you are trying to do, I don’t know what to say.
var houseTemplate =
g_(go.Group,"Auto",{ ... },
new go.Binding("background", "isHighlighted", function(h) { return h ? "rgba(255,0,0,0.2)":"transparent"; }).ofObject(),
g_(go.Shape, "Rectangle",{ fill : null, stroke : "#000000",strokeWidth : 2 },
//new go.Binding("desiredSize","desiredsize",go.Size.parse).makeTwoWay(go.Size.stringify) ),
g_(go.Panel, "Vertical",
......
g_(go.Placeholder,{
padding : 5,
alignment: go.Spot.Center})));
It is just what I need that using Placeholders in go.Group, So when a node is dropped into the group does automatically resize itself to surround its member nodes.
In the meantime, I want to know the desiredSize of houseTemplate .So I wrote the code :
new go.Binding("desiredSize","desiredsize",go.Size.parse).makeTwoWay(go.Size.stringify)
With this parameter bound, the size is fixed and the placeholder is invalid.There is conflict between desiredSize and placeholder,how to coordinate it?
Either you want to use a Placeholder or not.
https://gojs.net/latest/intro/groups.html
https://gojs.net/latest/intro/sizedGroups.html
It seems to me that your requirements conflict with each other.