Back to Digital Arts

Undo and snapping

A command stack for undo, and a snapping system modelled on Blender's.

Undo: history.js is a command stack with a limit of 100. Every tool produces a command with a label, a do function and an undo function, and undo must restore the geometry exactly. The stack has no dependency on the scene, which lets it wrap any edit.

Snapping: the first version rounded a value to a fixed increment while Ctrl was held. snapping.js replaced that with Blender's system, including the magnet in the viewport header, its dropdown, and snapping to other geometry.