(function(){ UndoStack.register([ { type: "create-scenery", undo: function(state){ Scenery.remove(state.id) // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, redo: function(state){ Scenery.deserialize([ state ]) // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, }, { type: "update-scenery", undo: function(state){ var scenery = Scenery.find(state.id) scenery.deserialize(state) scenery.set_wall(Rooms.walls[ state.wall_id ]) if (editor.permissions.resize) { Scenery.resize.show(scenery) } // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, redo: function(state){ var scenery = Scenery.find(state.id) scenery.deserialize(state) scenery.set_wall(Rooms.walls[ state.wall_id ]) if (editor.permissions.resize) { Scenery.resize.show(scenery) Scenery.resize.rotate_dots() Scenery.resize.move_dots() } // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, }, { type: "destroy-scenery", undo: function(state){ Scenery.deserialize([ state ]) // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, redo: function(state){ Scenery.remove(state.id) // TODO: watch individual scenery object here Minotaur.watch( app.router.editorView.settings ) }, }, // { type: "create-room", undo: function(room){ Rooms.remove(room) Rooms.clipper.update() }, redo: function(room){ Rooms.add(new Room(room)) Rooms.clipper.update() app.tube("builder-pick-room", room) }, }, { type: "update-room", undo: function(state){ var room = Rooms.list[state.id] room.rect.assign( state.rect ) room.height = state.height Rooms.clipper.update() app.tube("builder-pick-room", room) }, redo: function(state){ var room = Rooms.list[state.id] room.rect.assign( state.rect ) room.height = state.height Rooms.clipper.update() app.tube("builder-pick-room", room) }, }, { type: "destroy-room", undo: function(room){ Rooms.add(new Room(room)) Rooms.clipper.update() app.tube("builder-pick-room", room) }, redo: function(room){ Rooms.remove(room) Rooms.clipper.update() }, }, // { type: "update-wallpaper", undo: function(state){ }, redo: function(state){ }, }, ]) })()