From 665516c3952c75146628826a42d666ea845c3f64 Mon Sep 17 00:00:00 2001 From: tigerswithguitars Date: Thu, 18 Sep 2014 17:58:18 +0100 Subject: [PATCH 1/2] Add the pattern class to the fabric js typeings. --- fabricjs/fabricjs.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index d532b1c56..9903d9065 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -607,6 +607,21 @@ declare module fabric { loadFromDatalessJSON(json, callback: () => void): void; } + export interface IPattern { + (options: IPatternOptions): IPattern; + + initialise(options: IPatternOptions): IPattern; + + toLive(ctx: CanvasRenderingContext2D): IPattern; + toObject(): any; + toSVG(): string; + + offsetX: number; + offsetY: number; + repeat: string; + source: any; + } + export interface IBrightnessFilter { } export interface IInvertFilter { @@ -658,6 +673,13 @@ declare module fabric { stateful?: boolean; } + export interface IPatternOptions { + source: () => any; + offsetX: number; + offsetY: number; + repeat: string; + } + export interface IRectOptions extends IObjectOptions { x?: number; y?: number; @@ -697,6 +719,12 @@ declare module fabric { prototype: any; } + var Pattern: { + new (options: IPatternOptions): IPattern; + + prototype: any; + } + var Circle: { ATTRIBUTE_NAMES: string[]; fromElement(element: SVGElement, options: ICircleOptions): ICircle; From 6a93336c48e7865227429ffe150d000c28e628b3 Mon Sep 17 00:00:00 2001 From: tigerswithguitars Date: Thu, 18 Sep 2014 18:04:46 +0100 Subject: [PATCH 2/2] typo for the source, should be any, not function --- fabricjs/fabricjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 9903d9065..81397ea4a 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -674,7 +674,7 @@ declare module fabric { } export interface IPatternOptions { - source: () => any; + source: any; offsetX: number; offsetY: number; repeat: string;