There is no need to keep a reference to oldData because the old data already gets passed into the undo and redo objects. Additionally, there is no need to make 10's of undo objects per single tile edit, which currently happens. The added if( newTile !== oldTile ) check ensures we only have one undo object per edit, which is necessary before we can delete the oldData array.
This property can be deleted:
https://github.com/phoboslab/Impact/blob/98037a5f310858b3328e4a4537295b8df4a19c66/lib/weltmeister/edit-map.js#L18
And so can these two methods:
https://github.com/phoboslab/Impact/blob/98037a5f310858b3328e4a4537295b8df4a19c66/lib/weltmeister/edit-map.js#L81-L97
And then patch weltmeister.js as follows:
There is no need to keep a reference to
oldData
because the old data already gets passed into theundo
andredo
objects. Additionally, there is no need to make 10's ofundo
objects per single tile edit, which currently happens. The addedif( newTile !== oldTile )
check ensures we only have oneundo
object per edit, which is necessary before we can delete theoldData
array.