From 1efa24f2aa015beb1aa75c12cff9a9ef0f836eed Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 4 Sep 2012 00:50:12 -0300 Subject: [PATCH] - Fix Uncaught Icon can no be found., line:3940 --- .../commands/RemoveFeatureFromTopicCommand.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mindplot/src/main/javascript/commands/RemoveFeatureFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveFeatureFromTopicCommand.js index 3ebfe9d5..b3f6eae2 100644 --- a/mindplot/src/main/javascript/commands/RemoveFeatureFromTopicCommand.js +++ b/mindplot/src/main/javascript/commands/RemoveFeatureFromTopicCommand.js @@ -18,7 +18,7 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId, featureId) { + initialize:function (topicId, featureId) { $assert($defined(topicId), 'topicId can not be null'); $assert(featureId, 'iconModel can not be null'); @@ -28,7 +28,7 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({ this._oldFeature = null; }, - execute: function(commandContext) { + execute:function (commandContext) { var topic = commandContext.findTopics(this._topicId)[0]; var feature = topic.findFeatureById(this._featureId); @@ -36,11 +36,13 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({ this._oldFeature = feature; }, - undoExecute: function(commandContext) { + undoExecute:function (commandContext) { var topic = commandContext.findTopics(this._topicId)[0]; var feature = this._oldFeature; - topic.addFeature(feature.getType(), feature.getAttributes()); + var newFeature = topic.addFeature(feature.getType(), feature.getAttributes()); + this._featureId = newFeature.getModel().getId(); + this._oldFeature = null; } }); \ No newline at end of file