From 3438d5214117cec848384d9d3def034f440fd13e Mon Sep 17 00:00:00 2001 From: knuthelgesen Date: Sat, 12 May 2018 22:31:04 +0200 Subject: [PATCH] Added the method "get()" from the Croppie library so it's possible to read crop data (points, zoom and orientation) Added an interface for the crop data --- types/croppie/croppie-tests.ts | 2 ++ types/croppie/index.d.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/types/croppie/croppie-tests.ts b/types/croppie/croppie-tests.ts index 581d01435d..a82b04fabb 100644 --- a/types/croppie/croppie-tests.ts +++ b/types/croppie/croppie-tests.ts @@ -22,4 +22,6 @@ c.result({ type: 'blob' }).then(blob => { x = blob; }); +c.get(); + c.destroy(); diff --git a/types/croppie/index.d.ts b/types/croppie/index.d.ts index 97f53f84c8..a8b53c54e5 100644 --- a/types/croppie/index.d.ts +++ b/types/croppie/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Connor Peet // dklmuc // Sarun Intaralawan +// Knut Erik Helgesen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace Croppie; @@ -26,6 +27,8 @@ declare class Croppie { result(options: Croppie.ResultOptions & { type: 'rawcanvas' }): Promise; result(options?: Croppie.ResultOptions): Promise; + get(): Croppie.CropData; + rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; setZoom(zoom: number): void; @@ -59,4 +62,10 @@ declare namespace Croppie { showZoomer?: boolean; viewport?: { width: number, height: number, type?: CropType }; } + + interface CropData { + points?: number[]; + orientation?: number; + zoom?: number; + } }