From f3a13dfe7a6d635b9195827b4b9ef49dab768aef Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 7 Jul 2012 01:42:55 -0300 Subject: [PATCH] Fix issue when a node is reverted ... --- mindplot/src/main/javascript/commands/DeleteCommand.js | 3 ++- .../src/main/javascript/commands/MoveControlPointCommand.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mindplot/src/main/javascript/commands/DeleteCommand.js b/mindplot/src/main/javascript/commands/DeleteCommand.js index 99bb63ef..4720f883 100644 --- a/mindplot/src/main/javascript/commands/DeleteCommand.js +++ b/mindplot/src/main/javascript/commands/DeleteCommand.js @@ -41,7 +41,7 @@ mindplot.commands.DeleteCommand = new Class({ while (relationships.length > 0) { var relationship = relationships[0]; - this._deletedRelModel.push(relationship); + this._deletedRelModel.push(relationship.getModel().clone()); commandContext.deleteRelationship(relationship); } @@ -87,6 +87,7 @@ mindplot.commands.DeleteCommand = new Class({ }.bind(this) ); + this._deletedRelModel.forEach(function (model) { commandContext.addRelationship(model); }.bind(this)); diff --git a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js index c8e799c8..3419fe2b 100644 --- a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js +++ b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js @@ -17,7 +17,7 @@ */ mindplot.commands.MoveControlPointCommand = new Class({ Extends:mindplot.Command, - initialize: function(ctrlPointController, point) { + initialize:function (ctrlPointController, point) { $assert(ctrlPointController, 'line can not be null'); $assert($defined(point), 'point can not be null'); @@ -40,7 +40,7 @@ mindplot.commands.MoveControlPointCommand = new Class({ this._point = point; }, - execute: function(commandContext) { + execute:function (commandContext) { var model = this._line.getModel(); switch (this._point) { case 0: @@ -64,7 +64,7 @@ mindplot.commands.MoveControlPointCommand = new Class({ this._line.getLine().updateLine(this._point); }, - undoExecute: function(commandContext) { + undoExecute:function (commandContext) { var line = this._line; var model = line.getModel(); switch (this._point) {