- Remove fade event on node creation.

- Node are always hidden on creation.
This commit is contained in:
Paulo Gustavo Veiga 2012-09-28 00:07:34 -03:00
parent 6b76c53663
commit e72ae37ac7
4 changed files with 17 additions and 36 deletions

View File

@ -634,7 +634,6 @@ mindplot.Topic = new Class({
var elements = this._flatten2DElements(this); var elements = this._flatten2DElements(this);
var fade = new mindplot.util.FadeEffect(elements, !value); var fade = new mindplot.util.FadeEffect(elements, !value);
fade.addEvent('complete', function () { fade.addEvent('complete', function () {
}); });
fade.start(); fade.start();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
@ -840,7 +839,14 @@ mindplot.Topic = new Class({
// Hide all children... // Hide all children...
this._setChildrenVisibility(value); this._setChildrenVisibility(value);
// If there there are connection to the node, topic must be hidden.
this._setRelationshipLinesVisibility(value); this._setRelationshipLinesVisibility(value);
// If it's connected, the connection must be rendered.
var outgoingLine = this.getOutgoingLine();
if (outgoingLine) {
outgoingLine.setVisibility(value);
}
}, },
moveToBack:function () { moveToBack:function () {
@ -1037,7 +1043,7 @@ mindplot.Topic = new Class({
// Create a connection line ... // Create a connection line ...
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic); var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
outgoingLine.setVisibility(true); // @Todo: This must be false. Check remove of all nodes and redo. outgoingLine.setVisibility(false);
this._outgoingLine = outgoingLine; this._outgoingLine = outgoingLine;
workspace.appendChild(outgoingLine); workspace.appendChild(outgoingLine);

View File

@ -43,14 +43,14 @@ mindplot.commands.AddTopicCommand = new Class({
} }
} }
// Finally, focus ... // Select just created node ...
var designer = commandContext._designer; var designer = commandContext._designer;
var fade = new mindplot.util.FadeEffect([topic, topic.getOutgoingLine()], true); designer.onObjectFocusEvent(topic);
fade.addEvent('complete', function () { topic.setOnFocus(true);
designer.onObjectFocusEvent(topic);
topic.setOnFocus(true); // Render node ...
}); topic.setVisibility(true);
fade.start();
}.bind(this)); }.bind(this));
}, },

View File

@ -33,6 +33,7 @@ mindplot.commands.DragTopicCommand = new Class({
execute:function (commandContext) { execute:function (commandContext) {
var topic = commandContext.findTopics(this._topicsId)[0]; var topic = commandContext.findTopics(this._topicsId)[0];
topic.setVisibility(false);
// Save old position ... // Save old position ...
var origParentTopic = topic.getOutgoingConnectedTopic(); var origParentTopic = topic.getOutgoingConnectedTopic();
@ -69,6 +70,7 @@ mindplot.commands.DragTopicCommand = new Class({
this._parentId = origParentTopic.getId(); this._parentId = origParentTopic.getId();
} }
} }
topic.setVisibility(true);
// Store for undo ... // Store for undo ...
this._order = origOrder; this._order = origOrder;

View File

@ -144,33 +144,6 @@ mindplot.model.NodeModel = new Class({
this._parent = parent; this._parent = parent;
}, },
canBeConnected:function (sourceModel, sourcePosition, targetTopicSize) {
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
$assert(sourcePosition, 'childPosition can not be null.');
$assert(targetTopicSize, 'targetTopicSize can not be null.');
var result = false;
// Only can be connected if the node is in the left or right.
var targetModel = this;
var targetPosition = targetModel.getPosition();
// Finally, check current node position ...
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
var gap = 35 + targetTopicSize.height / 2;
if (targetModel.getChildren().length > 0) {
gap += Math.abs(targetPosition.y - targetModel.getChildren()[0].getPosition().y);
}
if (yDistance <= gap) {
// Circular connection ?
var xDistance = (sourcePosition.x - targetPosition.x) * Math.sign(targetPosition.x);
result = xDistance > targetTopicSize.width;
}
return result;
},
_isChildNode:function (node) { _isChildNode:function (node) {
var result = false; var result = false;
if (node == this) { if (node == this) {