- Minor fixes

This commit is contained in:
Paulo Gustavo Veiga 2012-09-27 08:12:03 -03:00
parent 3d1dc9bfc6
commit 4a0d70e3b3
2 changed files with 8 additions and 9 deletions

View File

@ -18,22 +18,21 @@
mindplot.commands.DragTopicCommand = new Class({
Extends:mindplot.Command,
initialize:function (topicIds, position, order, parentTopic) {
$assert(topicIds, "topicIds must be defined");
initialize:function (topicId, position, order, parentTopic) {
$assert(topicId, "topicId must be defined");
this._topicsIds = topicIds;
this._topicsId = topicId;
if ($defined(parentTopic))
this._parentId = parentTopic.getId();
this.parent();
this._position = position;
this._order = order;
this._id = mindplot.Command._nextUUID();
},
execute:function (commandContext) {
var topic = commandContext.findTopics([this._topicsIds])[0];
var topic = commandContext.findTopics(this._topicsId)[0];
// Save old position ...
var origParentTopic = topic.getOutgoingConnectedTopic();
@ -60,7 +59,7 @@ mindplot.commands.DragTopicCommand = new Class({
if (origParentTopic != this._parentId) {
if ($defined(this._parentId)) {
var parentTopic = commandContext.findTopics([this._parentId])[0];
var parentTopic = commandContext.findTopics(this._parentId)[0];
commandContext.connect(topic, parentTopic);
}

View File

@ -24,14 +24,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
this.parent();
this._value = value;
this._topicsIds = topicsIds;
this._topicsId = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
},
execute: function(commandContext) {
if (!this.applied) {
var topics = commandContext.findTopics(this._topicsIds);
var topics = commandContext.findTopics(this._topicsId);
topics.each(function(topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
@ -45,7 +45,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
undoExecute: function(commandContext) {
if (this.applied) {
var topics = commandContext.findTopics(this._topicsIds);
var topics = commandContext.findTopics(this._topicsId);
topics.each(function(topic, index) {
this._commandFunc(topic, this._oldValues[index]);