Relationships almost working
This commit is contained in:
@@ -17,14 +17,14 @@
|
||||
*/
|
||||
mindplot.commands.AddRelationshipCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(model, mindmap) {
|
||||
initialize: function(model) {
|
||||
$assert(model, 'Relationship model can not be null');
|
||||
this._model = model;
|
||||
this._mindmap = mindmap;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
var relationship = commandContext.createRelationship(this._model);
|
||||
|
||||
// Finally, focus ...
|
||||
var designer = commandContext._designer;
|
||||
designer.onObjectFocusEvent.attempt(relationship, designer);
|
||||
@@ -32,6 +32,8 @@ mindplot.commands.AddRelationshipCommand = new Class({
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
var relationship = commandContext.removeRelationship(this._model);
|
||||
this._mindmap.removeRelationship(this._model);
|
||||
|
||||
// @Todo: Esto esta mal. Designer toca el mindmap ...
|
||||
// this._mindmap.removeRelationship(this._model);
|
||||
}
|
||||
});
|
@@ -75,6 +75,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
this.execute(commandContext);
|
||||
var selectedRelationships = commandContext.filterSelectedRelations();
|
||||
|
@@ -23,7 +23,7 @@ mindplot.commands.freeMind.ReconnectTopicCommand = mindplot.Command.extend(
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
this._node = null;
|
||||
this._targetNode = null;
|
||||
this._relationship = null;
|
||||
this._pivot = null;
|
||||
this._oldParent = null;
|
||||
},
|
||||
execute: function(commandContext)
|
||||
@@ -46,12 +46,12 @@ mindplot.commands.freeMind.ReconnectTopicCommand = mindplot.Command.extend(
|
||||
}
|
||||
}
|
||||
var oldParent = this._oldParent!=null?commandContext.findTopics(parseInt(this._oldParent))[0]:null;
|
||||
node.relationship = this._relationship;
|
||||
node.relationship = this._pivot;
|
||||
node._relationship_oldParent = oldParent;
|
||||
node._relationship_index = this._index;
|
||||
commandContext.disconnect(node);
|
||||
var parentNode = targetNode;
|
||||
if(this._relationship != "Child"){
|
||||
if(this._pivot != "Child"){
|
||||
parentNode = targetNode.getParent();
|
||||
node._relationship_sibling_node = targetNode;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ mindplot.commands.freeMind.ReconnectTopicCommand = mindplot.Command.extend(
|
||||
}
|
||||
}
|
||||
var oldParent = commandContext.findTopics(parseInt(this._targetNode))[0];
|
||||
if(this._relationship != "Child"){
|
||||
if(this._pivot != "Child"){
|
||||
oldParent = oldParent.getParent();
|
||||
}
|
||||
if(targetNode!=null){
|
||||
@@ -113,6 +113,6 @@ mindplot.commands.freeMind.ReconnectTopicCommand = mindplot.Command.extend(
|
||||
this._targetNode = node.getId();
|
||||
},
|
||||
setAs:function(relationship){
|
||||
this._relationship = relationship;
|
||||
this._pivot = relationship;
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user