import { Point } from '../../Point'; import { FabricObject } from '../Object/FabricObject'; import { TComplexPathData, TPathSegmentInfo, TSimplePathData } from '../../util/path/typedefs'; import type { FabricObjectProps, SerializedObjectProps } from '../Object/types'; import type { TOptions } from '../../typedefs'; import type { ObjectEvents } from '../../EventTypeDefs'; import { TBBox, TClassProperties, TSVGReviver } from '../../typedefs'; import { WidgetPathInterface } from './type/widget.entity.path'; import { WidgetType } from './type/widget.type'; interface UniquePathProps { sourcePath?: string; path?: TSimplePathData; objType: 'XPath'; } export interface SerializedPathProps extends SerializedObjectProps, UniquePathProps { } export interface PathProps extends FabricObjectProps { objType: 'XPath'; } export interface IPathBBox extends TBBox { left: number; top: number; pathOffset: Point; } export declare class XPath = Partial, SProps extends SerializedPathProps = SerializedPathProps, EventSpec extends ObjectEvents = ObjectEvents> extends FabricObject implements WidgetPathInterface { /** * Array of path points * @type Array * @default */ path: TSimplePathData; pathOffset: Point; sourcePath?: string; segmentsInfo?: TPathSegmentInfo[]; static cacheProperties: string[]; locked: boolean; boardId: string; userId: string; timestamp: Date; zIndex: number; lines: object[]; relationship: object[]; id: string; userNo: string; version: string; lineWidth: any; radius: any; static objType: WidgetType; static type: WidgetType; /** * Constructor * @param {TComplexPathData} path Path data (sequence of coordinates and corresponding "command" tokens) * @param {Partial} [options] Options object * @return {Path} thisArg */ constructor(path: TComplexPathData | string, { path, left, top, ...options }?: Partial); updatedBy: string; updatedByName: string; createdByName: string; objType: WidgetType; updatedAt: number; createdAt: number; createdBy: string; static getDefaults(): { controls: { tl: import("../../..").Control; tr: import("../../..").Control; bl: import("../../..").Control; br: import("../../..").Control; }; }; /** * @private * @param {TComplexPathData | string} path Path data (sequence of coordinates and corresponding "command" tokens) * @param {boolean} [adjustPosition] pass true to reposition the object according to the bounding box * @returns {Point} top left position of the bounding box, useful for complementary positioning */ _setPath(path: TComplexPathData | string, adjustPosition?: boolean): void; /** * This function is an helper for svg import. it returns the center of the object in the svg * untransformed coordinates, by look at the polyline/polygon points. * @private * @return {Point} center point from element coordinates */ _findCenterFromElement(): Point; /** * @private * @param {CanvasRenderingContext2D} ctx context to render path on */ _renderPathCommands(ctx: CanvasRenderingContext2D): void; /** * @private * @param {CanvasRenderingContext2D} ctx context to render path on */ _render(ctx: CanvasRenderingContext2D): void; /** * Returns string representation of an instance * @return {string} string representation of an instance */ toString(): string; getObject(): Record; /** * Returns object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {Object} object representation of an instance */ toObject, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[]): Pick & SProps; /** * Returns dataless object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {Object} object representation of an instance */ toDatalessObject, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[]): Pick & SProps; /** * Returns svg representation of an instance * @return {Array} an array of strings with the specific svg representation * of the instance */ _toSVG(): string[]; /** * @private * @return the path command's translate transform attribute */ _getOffsetTransform(): string; /** * Returns svg clipPath representation of an instance * @param {Function} [reviver] Method for further parsing of svg representation. * @return {string} svg representation of an instance */ toClipPathSVG(reviver: TSVGReviver): any; /** * Returns svg representation of an instance * @param {Function} [reviver] Method for further parsing of svg representation. * @return {string} svg representation of an instance */ toSVG(reviver: TSVGReviver): any; /** * Returns number representation of an instance complexity * @return {number} complexity of this instance */ complexity(): number; setDimensions(): void; setBoundingBox(adjustPosition?: boolean): void; _calcBoundsFromPath(): TBBox; /** * @private */ _calcDimensions(): IPathBBox; /** * List of attribute names to account for when parsing SVG element (used by `Path.fromElement`) * @static * @memberOf Path * @see http://www.w3.org/TR/SVG/paths.html#PathElement */ static ATTRIBUTE_NAMES: string[]; /** * Creates an instance of Path from an object * @static * @memberOf Path * @param {Object} object * @returns {Promise} */ static fromObject>(object: T): Promise, SerializedPathProps, ObjectEvents>>; } export {}; //# sourceMappingURL=XPath.d.ts.map