Hello i use typescript and try to configure my groups in the way that nested groups & nodes are ungroupable.
The idea is that there are two type of groups, one wrapper of everything (subscriptions) and resource groups that nodes can exist only in resource groups.
my group template is the following
$(go.Group, "Spot",
{
toSpot: go.Spot.AllSides,
minSize: new go.Size(200, 200),
ungroupable: true,
computesBoundsAfterDrag: true,
handlesDragDropForMembers: true,
layout: $(go.LayeredDigraphLayout,
{
}),
mouseDrop: (e: go.InputEvent, node: any) => {
let ok = false;
const selectedGroupType = this.diagram.selection.first()?.data.GroupType;
if(node.data.GroupType === 'subscription' && selectedGroupType === "resourcegroup") {
node.addMembers(node.diagram.selection, true);
ok = true;
}
if(node.data.GroupType === 'resourcegroup' && !['subscription', 'resourcegroup'].includes(selectedGroupType )) {
node.addMembers(node.diagram.selection, true);
ok = true;
}
if(!ok) {
this.diagram.currentTool.doCancel()
}
},
},
new go.Binding('location', 'loc').makeTwoWay(),
$(go.Panel, "Auto",
$(go.Shape, "Rectangle",
{
name: "OBJSHAPE",
parameter1: 14,
},
new go.Binding("fill", 'GroupType', (e: string) => {
return e === 'subscription' ? 'rgba(115, 150, 190, 0.2)' : 'rgba(230, 249, 171, 0.2)'
})
),
$(go.Placeholder,
{ padding: 16 })
),
$(go.TextBlock,
{
alignment: go.Spot.TopLeft,
alignmentFocus: new go.Spot(0, 0, -4, -4),
font: "Bold 10pt Sans-Serif"
},
new go.Binding("text", "label")),
);
With that code im not able to move anything that is inside a group only to change the group size.
here 2 screenshots of the results before and after moving nodes & groups: