mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 15:56:56 +00:00
refactor: improve type safety for canvas data objects and remove unused FabricObject import
This commit is contained in:
@@ -3,9 +3,11 @@ import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
||||
|
||||
const PAD = 36;
|
||||
|
||||
type CanvasJSON = ReturnType<fabric.Canvas["toJSON"]>;
|
||||
|
||||
export type CanvasTools = {
|
||||
addImage: (url: string, file: File) => void;
|
||||
getData: () => { objects: any[] };
|
||||
getData: () => { objects: CanvasJSON["objects"] }; // no-any hack :/
|
||||
getJsonData: () => string;
|
||||
getImages: () => { src: string; file: File }[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user