import type { CSSUnitValue } from '../css';
import type { DisplayObjectConfig } from '../dom';
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
import { Shape } from '../types';
import { DisplayObject } from './DisplayObject';
import { enableCSSParsing } from '../globalContants/contants';
export interface GroupStyleProps extends BaseStyleProps {
x?: number | string;
y?: number | string;
width?: number | string;
height?: number | string;
}
export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
x: CSSUnitValue;
y: CSSUnitValue;
width?: CSSUnitValue;
height?: CSSUnitValue;
}
/**
* its attributes are inherited by its children.
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
* @example
*
*/
export class Group extends DisplayObject {
constructor({ style, ...rest }: DisplayObjectConfig = {}) {
super({
type: Shape.GROUP,
style: enableCSSParsing
? {
x: '',
y: '',
width: '',
height: '',
...style,
}
: {
...style,
},
...rest,
});
}
}