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

View File

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