Issue: Group Members Not Staying Within Bounds After Parent Resize and Collapse/Expand
Problem Description
I’m working with GoJS groups that contain multiple member nodes. We have a specific use case where:
- A group contains 3-4 child nodes
- When the user drags this child node upward (increasing the group’s height), the group size increases
- Subsequently, when we collapse and then expand the group, the child nodes remain at their original absolute positions
- This causes child nodes to appear outside the group boundaries after expansion
- The group only corrects itself when the user hovers over it again
Group Node Template Formation
Current Configuration
We’re using the following group properties:
// Applied via go.Binding
new go.Binding("computesBoundsAfterDrag", "", function(node) {
return node.isGroup;
});
new go.Binding("computesBoundsIncludingLocation", "", function(node) {
return node.isGroup;
});
We also have a custom ResizingTool that handles group resizing:
class CustomResizingTool extends go.ResizingTool {
resize(newr) {
const part = this.adornedObject.part;
if (!part) return;
// Custom resize logic with buffer calculations
super.resize(newr);
}
computeMinSize() {
const base = super.computeMinSize();
const ao = this.adornedObject;
const part = ao && ao.part;
if (!(part instanceof go.Group)) return base;
// Calculate min size based on placeholder/memberBounds
const ph = part.placeholder;
let bounds = ph?.actualBounds || part.memberBounds;
// ... padding calculations
return new go.Size(minW, minH);
}
}
Expected Behavior
After collapsing and expanding a resized group, child nodes should:
- Maintain their relative positions within the group
- Stay within the group’s visible boundaries
- Not require a hover event to trigger repositioning
Additional Context
- We’re using a compositional template system where groups are built from nested templates
- The group uses a
Placeholderfor member positioning - We have custom dragging tools (
GuidedDraggingTool) that may interact with the resize behavior - The issue specifically manifests during the expand operation after a resize
Additional Technical Details (if needed)
- Group template uses a
'Spot'panel type - We have a placeholder template for member positioning
- The resize is triggered by dragging a specific child node (acting as a handle)
- The
computesBoundsAfterDragproperty is set totruefor groups - We’re dispatching custom events during drag operations
Issue:
