Skip to content

Commit

Permalink
fix: fix rebase issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx committed Mar 5, 2024
1 parent 0de7ec9 commit 596d415
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/g6/src/elements/combos/base-combo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AABB, BaseStyleProps, DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
import { deepMix, isEmpty } from '@antv/util';
import type { BaseComboProps, Combo, Node, Position, PrefixObject, STDSize } from '../../types';
import { getBBoxHeight, getBBoxWidth, getElementsBBox, getExpandedBBox } from '../../utils/bbox';
import { getBBoxHeight, getBBoxWidth, getCombinedBBox, getExpandedBBox } from '../../utils/bbox';
import { getCollapsedMarkerText, getXYByCollapsedOrigin } from '../../utils/combo';
import { getXYByPosition } from '../../utils/element';
import { subStyleProps } from '../../utils/prefix';
Expand Down Expand Up @@ -95,8 +95,8 @@ export abstract class BaseCombo<S extends BaseComboStyleProps = BaseComboStylePr
}

protected getContentBBox(attributes: Required<S>): AABB {
const { children, padding } = attributes;
const childrenBBox = getElementsBBox(children!);
const { children = [], padding } = attributes;
const childrenBBox = getCombinedBBox(children.map((child) => child.getBounds()));

if (!padding) return childrenBBox;

Expand Down
5 changes: 2 additions & 3 deletions packages/g6/src/elements/combos/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type RectComboStyleProps = BaseComboStyleProps<KeyStyleProps>;
type ParsedRectComboStyleProps = ParsedBaseComboStyleProps<KeyStyleProps>;
type RectComboOptions = DisplayObjectConfig<RectComboStyleProps>;

export class RectCombo extends BaseCombo<GRect, KeyStyleProps> {
export class RectCombo extends BaseCombo<RectComboStyleProps> {
static defaultStyleProps: RectComboStyleProps = {
size: [100, 30],
anchor: [0.5, 0.5],
Expand All @@ -25,14 +25,13 @@ export class RectCombo extends BaseCombo<GRect, KeyStyleProps> {
}

protected getKeyStyle(attributes: ParsedRectComboStyleProps): GRectStyleProps {
const { collapsed } = attributes;
const keyStyle = super.getKeyStyle(attributes);
const collapsedStyle = subStyleProps(keyStyle, 'collapsed');

const [width, height] = this.getKeySize(attributes);
return {
...keyStyle,
...(collapsed && collapsedStyle),
...(attributes.collapsed && collapsedStyle),
width,
height,
};
Expand Down

0 comments on commit 596d415

Please sign in to comment.