- Fix position on Beta version maps during loading ...

This commit is contained in:
Paulo Gustavo Veiga 2012-06-23 19:51:14 -03:00
parent 63113a529d
commit a3d129a034
6 changed files with 366 additions and 334 deletions

View File

@ -1115,7 +1115,7 @@ mindplot.Topic = new Class({
if (this.getModel().isConnected())
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:this.getOutgoingConnectedTopic().getModel(), childNode: this.getModel()});
}
}
this._isInWorkspace = true;
this._adjustShapes();
},

View File

@ -118,6 +118,7 @@ mindplot.model.INodeModel = new Class({
},
setOrder : function(value) {
$assert(typeof value === 'number' && isFinite(value) || value == null, "Order must be null or a number");
this.putProperty('order', value);
},

View File

@ -30,6 +30,7 @@ mindplot.persistence.Pela2TangoMigrator = new Class({
var mindmap = this._pelaSerializer.loadFromDom(dom, mapId);
mindmap.setVersion(mindplot.persistence.ModelCodeName.TANGO);
this._fixOrder(mindmap);
this._fixPosition(mindmap);
return mindmap;
},
@ -56,11 +57,38 @@ mindplot.persistence.Pela2TangoMigrator = new Class({
});
for (i = 0; i < rightNodes.length; i++) {
rightNodes[i].setOrder(i*2);
rightNodes[i].setOrder(i * 2);
}
for (i = 0; i < leftNodes.length; i++) {
leftNodes[i].setOrder(i*2+1);
leftNodes[i].setOrder(i * 2 + 1);
}
},
_fixPosition : function(mindmap) {
// Position was not required in previous versions. Try to synthesize one .
var centralNode = mindmap.getBranches()[0];
var children = centralNode.getChildren();
for (var i = 0; i < children.length; i++) {
var child = children[i];
var position = child.getPosition();
this._fixNodePosition(child, position)
}
},
_fixNodePosition : function(node, parentPosition) {
// Position was not required in previous versions. Try to synthesize one .
var position = node.getPosition();
if (!position) {
position = {x:parentPosition.x + 30,y:parentPosition.y};
node.setPosition(position.x, position.y);
}
var children = node.getChildren();
for (var i = 0; i < children.length; i++) {
var child = children[i];
this._fixNodePosition(child, position);
}
}
});

View File

@ -195,7 +195,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
var order = domElem.getAttribute('order');
if ($defined(order)) {
topic.setOrder(order);
topic.setOrder(parseInt(order));
}
var shape = domElem.getAttribute('shape');

View File

@ -0,0 +1,4 @@
# Compilation and Execution
Your will find all the steps and required documentation here: http://www.wisemapping.org/downloads/source

View File

@ -1 +0,0 @@
# SMTP Server Configurat