- Fix errors on actions over central topic.

This commit is contained in:
Paulo Veiga
2011-11-30 00:56:21 -03:00
parent e520d9baba
commit dfc3bbdbe6
9 changed files with 28 additions and 26 deletions

View File

@@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
$assert(topicsIds, "topicsIds must be defined");
this._value = value;
this._objectsIds = topicsIds;
this._topicsIds = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
if (!this.applied) {
var topics = commandContext.findTopics(this._objectsIds);
var topics = commandContext.findTopics(this._topicsIds);
topics.forEach(function(topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
@@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
},
undoExecute: function(commandContext) {
if (this.applied) {
var topics = commandContext.findTopics(this._objectsIds);
var topics = commandContext.findTopics(this._topicsIds);
topics.forEach(function(topic, index) {
this._commandFunc(topic, this._oldValues[index]);