0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

add image

This commit is contained in:
Jordi Sala Morales 2024-04-10 11:08:55 +00:00
parent d341eb3fbe
commit 2a246e448e
No known key found for this signature in database
GPG key ID: C5127140107F55FD
4 changed files with 21 additions and 2 deletions

View file

@ -7,6 +7,7 @@ export const createPenpotImage = (
baseY: number
) => {
file.penpotFile.createImage({
type: Symbol.for('image'),
name: node.name,
x: node.x + baseX,
y: node.y + baseY,

View file

@ -1,4 +1,5 @@
import { CircleShape } from './types/circle/circleShape';
import { ImageShape } from './types/image/imageShape';
import { RectShape } from './types/rect/rectShape';
import { TextShape } from './types/text/textShape';
@ -17,8 +18,7 @@ export interface PenpotFile {
createRect(rect: RectShape): void;
createCircle(circle: CircleShape): void;
createText(options: TextShape): void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createImage(image: any): void;
createImage(image: ImageShape): void;
}
export function createFile(name: string): PenpotFile;

View file

@ -0,0 +1,14 @@
export type ImageAttributes = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
id?: any;
type: symbol;
// TODO: Investigate where it comes from
dataUri?: string;
metadata: {
width: number;
height: number;
mtype?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
id?: any;
};
};

View file

@ -0,0 +1,4 @@
import { Shape } from '../shape';
import { ImageAttributes } from './imageAttributes';
export type ImageShape = Shape & ImageAttributes;