You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
2.8 KiB
TypeScript

export interface FabricCanvasOption {
wrapperEl?: HTMLElement;
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export type FabricCanvas<T extends any = fabric.Canvas> = T &
FabricCanvasOption;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export type FabricObjectOption<T extends any = fabric.IObjectOptions> = T & {
/**
* Object id
* @type {string}
*/
id?: string;
/**
* Parent object id
* @type {string}
*/
parentId?: string;
/**
* Original opacity
* @type {number}
*/
originOpacity?: number;
/**
* Original top position
* @type {number}
*/
originTop?: number;
/**
* Original left position
* @type {number}
*/
originLeft?: number;
/**
* Original scale X
* @type {number}
*/
originScaleX?: number;
/**
* Original scale Y
* @type {number}
*/
originScaleY?: number;
/**
* Original angle
* @type {number}
*/
originAngle?: number;
/**
* Original fill color
*
* @type {(string | fabric.Pattern | fabric.Gradient)}
*/
originFill?: string | fabric.Pattern | fabric.Gradient;
/**
* Original stroke color
* @type {string}
*/
originStroke?: string;
/**
* Original rotation
*
* @type {number}
*/
originRotation?: number;
/**
* Object editable
* @type {boolean}
*/
editable?: boolean;
/**
* Object Super type
* @type {string}
*/
superType?: string;
/**
* @description
* @type {string}
*/
description?: string;
/**
* Animation property
* @type {AnimationProperty}
*/
animation?: AnimationProperty;
/**
* Anime instance
* @type {anime.AnimeInstance}
*/
anime?: anime.AnimeInstance;
/**
* Tooltip property
* @type {TooltipProperty}
*/
tooltip?: TooltipProperty;
/**
* Link property
* @type {LinkProperty}
*/
link?: LinkProperty;
/**
* Is running animation
* @type {boolean}
*/
animating?: boolean;
/**
* Object class
* @type {string}
*/
class?: string;
/**
* Is possible delete
* @type {boolean}
*/
deletable?: boolean;
/**
* Is enable double click
* @type {boolean}
*/
dblclick?: boolean;
/**
* Is possible clone
* @type {boolean}
*/
cloneable?: boolean;
/**
* Is locked object
* @type {boolean}
*/
locked?: boolean;
/**
* This property replaces "angle"
*
* @type {number}
*/
rotation?: number;
/**
* Whether it can be clicked
*
* @type {boolean}
*/
clickable?: boolean;
[key: string]: any;
};
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export type FabricObject<T extends any = fabric.Object> = T &
FabricObjectOption;
export type FabricObjects = {
[key: string]: {
create: (...args: any) => FabricObject;
};
};