From db73f28f5316fd40992664afef28e4b71fa64c28 Mon Sep 17 00:00:00 2001 From: Bryan Krol Date: Mon, 8 Apr 2019 12:24:39 -0400 Subject: [PATCH] Added some additional type defs based on my current needs. --- types/fabric/fabric-impl.d.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 37038912fa..7add5b5630 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -1075,6 +1075,8 @@ export class StaticCanvas { */ constructor(element: HTMLCanvasElement | string, options?: ICanvasOptions); + _activeObject?: Object | Group; + /** * Calculates canvas element offset relative to the document * This method is also attached as "resize" event handler of window @@ -1454,7 +1456,7 @@ export class StaticCanvas { * @return {Boolean | null} `true` if method is supported (or at least exists), * `null` if canvas element or context can not be initialized */ - supports(methodName: "getImageData" | "toDataURL" | "toDataURLWithQuality" | "setLineDash"): boolean; + static supports(methodName: "getImageData" | "toDataURL" | "toDataURLWithQuality" | "setLineDash"): boolean; /** * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately @@ -2347,6 +2349,11 @@ export class Line { * Produces a function that calculates distance from canvas edge to Line origin. */ makeEdgeToOriginGetter(propertyNames: {origin: number, axis1: any, axis2: any, dimension: any}, originValues: {nearest: any, center: any, farthest: any}): Function; + /** + * Recalculates line points given width and height + * @private + */ + calcLinePoints(): {x1: number, x2: number, y1: number, y2: number}; } interface IObjectOptions { @@ -3550,7 +3557,7 @@ export class Object { * @param {Array} dashArray array representing dashes * @param {Function} alternative function to call if browser does not support lineDash */ - _setLineDash(ctx: CanvasRenderingContext2D, dashArray: number[], alternative: Function): void; + _setLineDash(ctx: CanvasRenderingContext2D, dashArray: number[], alternative?: (ctx: CanvasRenderingContext2D) => void): void; /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on @@ -3559,6 +3566,16 @@ export class Object { * @return {Object} offset.offsetY offset for text rendering */ _applyPatternGradientTransform(ctx: CanvasRenderingContext2D, filler: string | Pattern | Gradient): void; + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render(ctx: CanvasRenderingContext2D): void; + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderPaintInOrder(ctx: CanvasRenderingContext2D): void; } interface IPathOptions extends IObjectOptions {