@aurigma/design-atoms-model
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
50 lines (49 loc) • 2.08 kB
TypeScript
import { Transform } from "./Transform";
import { PointF } from "./PointF";
import { SizeF } from "./SizeF";
import { RotatedRectangleF } from "./RotatedRectangleF";
export declare class PathSegment {
private _name;
private _points;
constructor(name: string, points?: PointF[]);
get name(): string;
getPoint(index: number): PointF;
get length(): number;
transform(transform: Transform, center: PointF): void;
rotateAt(angle: number, center: PointF): void;
translate(offsetX: number, offsetY: number): void;
scale(scaleX: number, scaleY: number): void;
draw(ctx: CanvasRenderingContext2D): void;
toString(): string;
clone(): PathSegment;
}
export declare class Path {
private _segments;
private _pathChangedEvent;
constructor(path?: string);
get length(): number;
get segments(): PathSegment[];
addPathChanged(handler: (t: Transform) => any): void;
removePathChanged(handler: any): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
quadraticTo(cx: number, cy: number, x: number, y: number): void;
cubicTo(cx1: number, cy1: number, cx2: number, cy2: number, x: number, y: number): void;
close(): void;
private _onPathChanged;
transform(transform: Transform, center: PointF): void;
rotateAt(angle: number, center: PointF): void;
translate(offsetX: number, offsetY: number): void;
scale(scaleX: number, scaleY: number): void;
draw(ctx: CanvasRenderingContext2D): void;
toString(): string;
clone(): Path;
equals(p: Path): boolean;
isEqual(path: Path): boolean;
addPath(path: Path): void;
private _fromString;
static rectangle(left: number, top: number, width: number, height: number): Path;
static ellipse(left: number, top: number, width: number, height: number): Path;
static roundedRectangle(left: number, top: number, width: number, height: number, radiuses: SizeF[]): Path;
static rotatedRectangle(rectangle: RotatedRectangleF): Path;
}