fixing original layout bugs

This commit is contained in:
Pablo Luna 2011-04-16 15:52:21 +01:00
parent 4e746833ae
commit 60ab4c7f5d
4 changed files with 16 additions and 7 deletions

View File

@ -199,7 +199,12 @@ mindplot.FixedDistanceBoard.prototype.repositionate = function()
var lowerLimit; var lowerLimit;
if (entries.length > 0) if (entries.length > 0)
{ {
var topic = entries[0].getTopic(); var l = 0;
for(l=0; l<entries.length; l++){
if(core.Utils.isDefined(entries[l]))
break;
}
var topic = entries[l].getTopic();
var firstNodeHeight = topic.getSize().height; var firstNodeHeight = topic.getSize().height;
lowerLimit = refence.y - (height / 2) - (firstNodeHeight / 2) + 1; lowerLimit = refence.y - (height / 2) - (firstNodeHeight / 2) + 1;
} }

View File

@ -152,7 +152,7 @@ mindplot.NodeModel.prototype._removeLink = function(link)
mindplot.NodeModel.prototype.createNote = function(text) mindplot.NodeModel.prototype.createNote = function(text)
{ {
core.assert(text, 'note text must be specified.'); core.assert(text!=null, 'note text must be specified.');
return new mindplot.NoteModel(text, this); return new mindplot.NoteModel(text, this);
}; };

View File

@ -18,7 +18,7 @@
mindplot.NoteModel = function(text, topic) mindplot.NoteModel = function(text, topic)
{ {
core.assert(text, 'note text can not be null'); core.assert(text!=null, 'note text can not be null');
core.assert(topic, 'mindmap can not be null'); core.assert(topic, 'mindmap can not be null');
this._text = text; this._text = text;
this._topic = topic; this._topic = topic;

View File

@ -25,12 +25,16 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
var order = child.getOrder(); var order = child.getOrder();
if (!core.Utils.isDefined(order)) if (!core.Utils.isDefined(order))
{ {
order = maxOrder++; order = ++maxOrder;
child.setOrder(order);
} }
if(nodesByOrder.hasKey(order)){ if(nodesByOrder.hasKey(order)){
//duplicated order. Change order to next available. if(Math.sign(child.getPosition().x) == Math.sign(nodesByOrder.get(order).getPosition().x)){
order = maxOrder++; //duplicated order. Change order to next available.
order = ++maxOrder;
child.setOrder(order);
}
}else{ }else{
nodesByOrder.set(order, child); nodesByOrder.set(order, child);
if(order>maxOrder) if(order>maxOrder)
@ -40,7 +44,7 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
} }
} }
nodesByOrder=null; nodesByOrder=null;
return result; return node.getTopicType()!=mindplot.NodeModel.CENTRAL_TOPIC_TYPE?result:children;
}, },
_nodeResizeEvent:function(node){ _nodeResizeEvent:function(node){