From 90eb4f593aede36724e43bafbc125f5572a59d5a Mon Sep 17 00:00:00 2001 From: Kyle Kaniecki Date: Mon, 14 Oct 2019 13:48:10 -0400 Subject: [PATCH] Fixed Fabric Object animation function to include correct parameters (#39069) * fixed object animate function to include correct parameters * credit * guess not since you can't use gitlab urls * updated fabric version number * only allow major and minor patch * fixed some inaccurate documentation and added properties interface to parameter --- types/fabric/fabric-impl.d.ts | 19 +++++++++++++++---- types/fabric/index.d.ts | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 0c041ad667..a9bc546b86 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -368,10 +368,10 @@ interface IObjectAnimation { /** * Animates object's properties * object.animate({ left: ..., top: ... }, { duration: ... }); - * @param properties Properties to animate - * @param value Options object + * @param properties Properties to animate with values to animate to + * @param options The animation options */ - animate(properties: any, options?: IAnimationOptions): Object; + animate(properties: {[key: string]: number | string}, options?: IAnimationOptions): Object; } interface IAnimationOptions { /** @@ -3506,8 +3506,19 @@ export class Object { intersectsWithRect(pointTL: any, pointBR: any, absolute?: boolean, calculate?: boolean): boolean; /** * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options */ - animate(): Object; + animate(property: string, value: number | string, options?: IAnimationOptions): Object; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate with values to animate to + * @param options The animation options + */ + animate(properties: {[key: string]: number | string}, options?: IAnimationOptions): Object; /** * Calculate and returns the .coords of an object. * @return {Object} Object with tl, tr, br, bl .... diff --git a/types/fabric/index.d.ts b/types/fabric/index.d.ts index f423c265e6..832744c095 100644 --- a/types/fabric/index.d.ts +++ b/types/fabric/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for FabricJS 3.0 +// Type definitions for FabricJS 3.4 // Project: http://fabricjs.com/ // Definitions by: Oliver Klemencic // Joseph Livecchi