MCPcopy Create free account
hub / github.com/experdot/pointer / undo

Function undo

src/renderer/src/components/common/ImageEditor.tsx:163–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161 }
162
163 const undo = () => {
164 if (currentHistoryIndex <= 0) return
165
166 const canvas = canvasRef.current
167 if (!canvas) return
168
169 const ctx = canvas.getContext('2d')
170 if (!ctx) return
171
172 const newIndex = currentHistoryIndex - 1
173 ctx.putImageData(history[newIndex].imageData, 0, 0)
174 setCurrentHistoryIndex(newIndex)
175 }
176
177 const redo = () => {
178 if (currentHistoryIndex >= history.length - 1) return

Callers 1

handleKeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected