fabric.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. declare module 'fabric' {
  2. interface FabricObject {
  3. id: `${string}-${string}-${string}-${string}-${string}`;
  4. lockScaleUniform: boolean;
  5. maxScaleLimit: number;
  6. }
  7. interface FabricObjectProps {
  8. lockScaleUniform?: boolean;
  9. maxScaleLimit?: number;
  10. }
  11. interface CanvasEvents {
  12. 'before:object:created': { object: import('fabric').FabricObject };
  13. 'object:created': { object: import('fabric').FabricObject };
  14. 'brush:invalid': {
  15. reason: 'outOfRegion' | 'dragTooShort' | 'selfIntersection' | 'degenerateTriangle' | 'closeWouldIntersect' | 'polygonTooFewPoints' | 'dragBoundsInvalid';
  16. point: { x: number; y: number };
  17. vertexCount?: number;
  18. detail?: Record<string, unknown>;
  19. };
  20. 'brush:start': {
  21. shape?: 'rect' | 'circle' | 'ellipse' | 'triangle' | 'polyline' | 'polygon';
  22. };
  23. 'brush:end': {
  24. shape?: 'rect' | 'circle' | 'ellipse' | 'triangle' | 'polyline' | 'polygon';
  25. };
  26. }
  27. interface ObjectEvents {
  28. 'snapshot:start': { target: import('fabric').FabricObject };
  29. 'snapshot:end': { target: import('fabric').FabricObject };
  30. }
  31. }
  32. export {};