Skip to content

Commit

Permalink
fix(collapse):Fix child positions on group expand
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Feb 21, 2024
1 parent bed1c18 commit 1a46393
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/module/src/components/groups/DefaultGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { observer } from 'mobx-react';
import DefaultGroupExpanded from './DefaultGroupExpanded';
import { OnSelect, WithDndDragProps, ConnectDragSource, ConnectDropTarget } from '../../behavior';
import { BadgeLocation, GraphElement, isNode, LabelPosition, Node } from '../../types';
import DefaultGroupCollapsed from './DefaultGroupCollapsed';
import { ShapeProps } from '../nodes';
import { Dimensions } from '../../geom';
import DefaultGroupCollapsed from './DefaultGroupCollapsed';

interface DefaultGroupProps {
/** Additional classes added to the group */
Expand Down Expand Up @@ -91,7 +92,7 @@ const DefaultGroupInner: React.FunctionComponent<DefaultGroupInnerProps> = obser
}) => {
const handleCollapse = (group: Node, collapsed: boolean): void => {
if (collapsed && rest.collapsedWidth !== undefined && rest.collapsedHeight !== undefined) {
group.setBounds(group.getBounds().setSize(rest.collapsedWidth, rest.collapsedHeight));
group.setDimensions(new Dimensions(rest.collapsedWidth, rest.collapsedHeight));
}
group.setCollapsed(collapsed);
onCollapseChange && onCollapseChange(group, collapsed);
Expand Down
2 changes: 1 addition & 1 deletion packages/module/src/elements/BaseNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class BaseNode<E extends NodeModel = NodeModel, D = any> extends
updateChildrenPositions(point: Point, prevLocation: Point): void {
const xOffset = point.x - prevLocation.x;
const yOffset = point.y - prevLocation.y;
this.getChildren().forEach(child => {
this.getAllNodeChildren().forEach(child => {
if (isNode(child)) {
const node = child as Node;
const position = node.getPosition();
Expand Down

0 comments on commit 1a46393

Please sign in to comment.