MCPcopy Create free account
hub / github.com/Shitanshukumar607/Drawspace / HistoryStore

Interface HistoryStore

context/historyStore.ts:42–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40});
41
42interface HistoryStore {
43 current: CanvasState;
44
45 past: CanvasState[];
46 future: CanvasState[];
47
48 maxHistorySize: number;
49
50 setFreeDrawingLines: (lines: FreeDrawingLineWithProps[]) => void;
51 addFreeDrawingLine: (line: FreeDrawingLineWithProps) => void;
52 updateLastFreeDrawingLine: (
53 updater: (line: FreeDrawingLineWithProps) => FreeDrawingLineWithProps
54 ) => void;
55
56 setLines: (lines: LineShapeWithProps[]) => void;
57 addLine: (line: LineShapeWithProps) => void;
58 updateLine: (id: string, updates: Partial<LineShapeWithProps>) => void;
59
60 setRectangles: (rectangles: RectangleShapeWithProps[]) => void;
61 addRectangle: (rectangle: RectangleShapeWithProps) => void;
62 updateRectangle: (
63 id: string,
64 updates: Partial<RectangleShapeWithProps>
65 ) => void;
66
67 setEllipses: (ellipses: EllipseShapeWithProps[]) => void;
68 addEllipse: (ellipse: EllipseShapeWithProps) => void;
69 updateEllipse: (id: string, updates: Partial<EllipseShapeWithProps>) => void;
70
71 setArrows: (arrows: ArrowShapeWithProps[]) => void;
72 addArrow: (arrow: ArrowShapeWithProps) => void;
73 updateArrow: (id: string, updates: Partial<ArrowShapeWithProps>) => void;
74
75 saveToHistory: () => void;
76 undo: () => void;
77 redo: () => void;
78 canUndo: () => boolean;
79 canRedo: () => boolean;
80}
81
82const useHistoryStore = create<HistoryStore>((set, get) => ({
83 current: createEmptyState(),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected