class CustomResizingTool extends go.ResizingTool {
// override ResizingTool.resize to change width of member nodes;
// this assumes that all nodes should occupy the full width of the group
resize(newr) {
super.resize(newr);
var group = this.adornedObject.part; // the resized element's Part
// set all member nodes to the left side of the group, with the new given width
if (group instanceof go.Group) {
// determine left side for each node
const x = this.adornedObject.getDocumentPoint(go.Spot.Left).x + newr.x;
group.memberParts.each(node => {
if (node instanceof go.Link) return;
node.position = new go.Point(x, node.actualBounds.y);
node.resizeObject.width = newr.width;
});
}
}
} // end CustomResizingTool
Install by replacing the regular ResizingTool, such as by:
$(go.Diagram, . . .,
{
resizingTool: new CustomResizingTool(),
"resizingTool.isGridSnapEnabled": true,
. . .
})