Improve undo for scaling/moving of content

An undo event is always generated as soon as the selection is
moved/scaled and not only after the selection is removed. This
makes it possible to correctly undo a series of moving/scaling
operations although occasionaly move undos are created even
if the content was only scaled.