2dbi
Home/Figma/Implement Undo/Redo for Canvas Operations
FFigma·DSAProduct EngTechnical Phone Screen

Implement Undo/Redo for Canvas Operations

Problem

Implement undo/redo after a series of canvas operations (move, resize, delete, group).

Example

ops -> undo() restores previous state; redo() reapplies

Constraints

  • Bounded history; grouped ops undo together

Approach

Command pattern with inverse ops on two stacks.

added 6 days ago
LeadersAccount