UNPKG

react-fabric-canvas-designer

Version:

A React-based wrapper for Fabric.js to create interactive and customizable canvas-based designs. This library provides tools for drawing, editing, and managing objects on a canvas with React-friendly APIs.

21 lines (20 loc) 715 B
import { EllipseObj } from "./Objects/EllipseObj"; import { FabricImageObj } from "./Objects/FabricImageObj"; import { RectObj } from "./Objects/RectObj"; import { TextBoxObj } from "./Objects/TextBoxObj"; export class FabricObjectAdapter { static createAdapter(type, fbObj) { switch (type) { case "rect": return new RectObj(fbObj); case "ellipse": return new EllipseObj(fbObj); case "image": return new FabricImageObj(fbObj); case "textbox": return new TextBoxObj(fbObj); default: throw new Error("Can not find the given object type " + type); } } }