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
This commit is contained in:
knuthelgesen
2018-05-12 22:31:04 +02:00
parent a68f617d89
commit 3438d52141
2 changed files with 11 additions and 0 deletions
+2
View File
@@ -22,4 +22,6 @@ c.result({ type: 'blob' }).then(blob => {
x = blob;
});
c.get();
c.destroy();
+9
View File
@@ -3,6 +3,7 @@
// Definitions by: Connor Peet <https://github.com/connor4312>
// dklmuc <https://github.com/dklmuc>
// Sarun Intaralawan <https://github.com/sarunint>
// Knut Erik Helgesen <https://github.com/knuthelgesen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace Croppie;
@@ -26,6 +27,8 @@ declare class Croppie {
result(options: Croppie.ResultOptions & { type: 'rawcanvas' }): Promise<HTMLCanvasElement>;
result(options?: Croppie.ResultOptions): Promise<HTMLCanvasElement>;
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;
}
}