- 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 fade = new mindplot.util.FadeEffect(elements, !value);
fade.addEvent('complete', function () {
});
fade.start();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
@ -840,7 +839,14 @@ mindplot.Topic = new Class({
// Hide all children...
this._setChildrenVisibility(value);
// If there there are connection to the node, topic must be hidden.
this._setRelationshipLinesVisibility(value);
// If it's connected, the connection must be rendered.
var outgoingLine = this.getOutgoingLine();
if (outgoingLine) {
outgoingLine.setVisibility(value);
}
},
moveToBack:function () {
@ -1037,7 +1043,7 @@ mindplot.Topic = new Class({
// Create a connection line ...
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;
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 fade = new mindplot.util.FadeEffect([topic, topic.getOutgoingLine()], true);
fade.addEvent('complete', function () {
designer.onObjectFocusEvent(topic);
topic.setOnFocus(true);
});
fade.start();
designer.onObjectFocusEvent(topic);
topic.setOnFocus(true);
// Render node ...
topic.setVisibility(true);
}.bind(this));
},

View File

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

View File

@ -144,33 +144,6 @@ mindplot.model.NodeModel = new Class({
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) {
var result = false;
if (node == this) {