-
{name}
+ const initialCanvas = useCallback((): void => {
+ let newCanvas = new fabric.Canvas(props.id || "canvas");
+ newCanvas.uniScaleTransform = true;
+ newCanvas.on("mouse:dblclick", doubleClickEvent);
+ newCanvas.on("object:modified", setOutput);
+ setCanvas(newCanvas);
+ initialImage();
+ }, [setCanvas, initialImage]);
+
+ useEffect(() => {
+ initialCanvas();
+ }, [initialCanvas, initialImage, loadImage, initialObjects]);
+
+ return (
+
+
{name}
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
- );
- }
-}
+
+
+
+ );
+};
+
+ReactMultiCrop.defaultProps = defaultProps;
+
+export default ReactMultiCrop;
diff --git a/src/ReactMultiCrop/ReactMultiCrop.types.ts b/src/ReactMultiCrop/ReactMultiCrop.types.ts
index 6e8c966..a217a23 100644
--- a/src/ReactMultiCrop/ReactMultiCrop.types.ts
+++ b/src/ReactMultiCrop/ReactMultiCrop.types.ts
@@ -1,15 +1,11 @@
-export type ReactMultiCropProps = {
- id: string;
+import { InputProps } from "react-admin";
+
+export interface ReactMultiCropProps extends InputProps {
+ id?: string;
color?: string;
opacity?: number;
strokeColor?: string;
strokeDashArray?: Array