mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-02-25 16:26:23 -05:00
add group
This commit is contained in:
parent
93ba8eec4f
commit
7383d87125
4 changed files with 19 additions and 3 deletions
|
@ -7,9 +7,14 @@ export const createPenpotGroup = (
|
|||
baseX: number,
|
||||
baseY: number
|
||||
) => {
|
||||
file.penpotFile.addGroup({ name: node.name });
|
||||
file.penpotFile.addGroup({
|
||||
type: Symbol.for('group'),
|
||||
name: node.name
|
||||
});
|
||||
|
||||
for (const child of node.children) {
|
||||
createPenpotItem(file, child, baseX, baseY);
|
||||
}
|
||||
|
||||
file.penpotFile.closeGroup();
|
||||
};
|
||||
|
|
4
src/ui/lib/penpot.d.ts
vendored
4
src/ui/lib/penpot.d.ts
vendored
|
@ -1,4 +1,5 @@
|
|||
import { CircleShape } from './types/circle/circleShape';
|
||||
import { GroupShape } from './types/group/groupShape';
|
||||
import { ImageShape } from './types/image/imageShape';
|
||||
import { RectShape } from './types/rect/rectShape';
|
||||
import { TextShape } from './types/text/textShape';
|
||||
|
@ -12,8 +13,7 @@ export interface PenpotFile {
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
addArtboard(artboard: any): void;
|
||||
closeArtboard(): void;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
addGroup(group: any): void;
|
||||
addGroup(group: GroupShape): void;
|
||||
closeGroup(): void;
|
||||
createRect(rect: RectShape): void;
|
||||
createCircle(circle: CircleShape): void;
|
||||
|
|
7
src/ui/lib/types/group/groupAttributes.d.ts
vendored
Normal file
7
src/ui/lib/types/group/groupAttributes.d.ts
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
export type GroupAttributes = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
id?: any;
|
||||
type: symbol;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
shapes?: any[];
|
||||
};
|
4
src/ui/lib/types/group/groupShape.d.ts
vendored
Normal file
4
src/ui/lib/types/group/groupShape.d.ts
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { Shape } from '../shape';
|
||||
import { GroupAttributes } from './groupAttributes';
|
||||
|
||||
export type GroupShape = Shape & GroupAttributes;
|
Loading…
Add table
Reference in a new issue