Fix scratchpad undo

Three undo bugs fixed:
1) Undo didn't work at all (mousedown was saving state when
   toolbar was clicked).
2) Undo was adding back in clipped lines.
3) Using the eraser added state to undo even if you didn't
   actually erase anything. (N.B. stopped using shapes.length
   here as it doesn't work: .length doesn't change when things
   are .remove()'d)