fixing freemind layout with import
This commit is contained in:
@@ -29,7 +29,7 @@ mindplot.ConnectionLine = function(sourceNode, targetNode, lineType)
|
||||
var line;
|
||||
if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
||||
{
|
||||
line = this._createLine(lineType,mindplot.ConnectionLine.SIMPLE_CURVED);
|
||||
line = this._createLine(lineType,mindplot.ConnectionLine.CURVED);
|
||||
// line = new web2d.Line();
|
||||
if(line.getType()=="CurvedLine"){
|
||||
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
||||
@@ -86,7 +86,7 @@ mindplot.ConnectionLine.prototype._createLine = function(lineType, defaultStyle)
|
||||
|
||||
mindplot.ConnectionLine.getStrokeColor = function()
|
||||
{
|
||||
return '#495879';
|
||||
return '#c8e794';
|
||||
};
|
||||
|
||||
mindplot.ConnectionLine.prototype.setVisibility = function(value)
|
||||
|
@@ -84,7 +84,7 @@ mindplot.RelationshipLine.prototype.redraw = function()
|
||||
line2d.setFrom(sPos.x, sPos.y);
|
||||
line2d.setTo(tPos.x, tPos.y);
|
||||
|
||||
line2d.moveToBack();
|
||||
line2d.moveToFront();
|
||||
|
||||
//Positionate Arrows
|
||||
this._positionateArrows();
|
||||
|
@@ -41,20 +41,23 @@ mindplot.ShirinkConnector = function(topic)
|
||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, isShrink, [topicId]);
|
||||
actionRunner.execute(command);
|
||||
|
||||
new Event(event).stop();
|
||||
var event = new Event(event).stop();
|
||||
event.preventDefault();
|
||||
|
||||
});
|
||||
|
||||
elipse.addEventListener('click', function(event)
|
||||
elipse.addEventListener('mousedown', function(event)
|
||||
{
|
||||
// Avoid node creation ...
|
||||
new Event(event).stop();
|
||||
var event = new Event(event).stop();
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
elipse.addEventListener('dblclick', function(event)
|
||||
{
|
||||
// Avoid node creation ...
|
||||
new Event(event).stop();
|
||||
event = new Event(event).stop();
|
||||
event.preventDefault();
|
||||
|
||||
});
|
||||
|
||||
|
@@ -178,7 +178,7 @@ mindplot.Topic.prototype.buildShape = function(attributes, type)
|
||||
}
|
||||
else if (type == mindplot.NodeModel.SHAPE_TYPE_LINE)
|
||||
{
|
||||
result = new web2d.Line({strokeWidth:1, strokeOpacity:1});
|
||||
result = new web2d.Line({strokeColor:"#c8e794",strokeWidth:1, strokeOpacity:1});
|
||||
result.setSize = function(width, height)
|
||||
{
|
||||
this.size = {width:width, height:height};
|
||||
@@ -992,31 +992,32 @@ mindplot.Topic.prototype.moveToBack = function(){
|
||||
// this._helpers.forEach(function(helper, index){
|
||||
// helper.moveToBack();
|
||||
// });
|
||||
this.get2DElement().moveToBack();
|
||||
var outgoingLine = this.getOutgoingLine();
|
||||
|
||||
// Update relationship lines
|
||||
for(var j=0; j<this._relationships.length; j++){
|
||||
this._relationships[j].moveToBack();
|
||||
}
|
||||
var connector = this.getShrinkConnector();
|
||||
if(connector){
|
||||
connector.moveToBack();
|
||||
}
|
||||
|
||||
if(outgoingLine){
|
||||
outgoingLine.moveToBack();
|
||||
}
|
||||
this.get2DElement().moveToBack();
|
||||
|
||||
|
||||
};
|
||||
|
||||
mindplot.Topic.prototype.moveToFront = function(){
|
||||
|
||||
var outgoingLine = this.getOutgoingLine();
|
||||
if(outgoingLine){
|
||||
outgoingLine.moveToFront();
|
||||
}
|
||||
this.get2DElement().moveToFront();
|
||||
var connector = this.getShrinkConnector();
|
||||
if(connector){
|
||||
connector.moveToFront();
|
||||
}
|
||||
this.get2DElement().moveToFront();
|
||||
// Update relationship lines
|
||||
for(var j=0; j<this._relationships.length; j++){
|
||||
this._relationships[j].moveToFront();
|
||||
}
|
||||
|
||||
// this._helpers.forEach(function(helper, index){
|
||||
// helper.moveToFront();
|
||||
// });
|
||||
@@ -1225,11 +1226,6 @@ mindplot.Topic.prototype.getOrder = function()
|
||||
return model.getOrder();
|
||||
};
|
||||
|
||||
mindplot.Topic.prototype.moveToFront = function()
|
||||
{
|
||||
var elem2d = this.get2DElement();
|
||||
elem2d.moveToFront();
|
||||
};
|
||||
mindplot.Topic.prototype.setOrder = function(value)
|
||||
{
|
||||
var model = this.getModel();
|
||||
|
@@ -27,6 +27,10 @@ mindplot.commands.AddRelationshipCommand = mindplot.Command.extend(
|
||||
execute: function(commandContext)
|
||||
{
|
||||
var relationship = commandContext.createRelationship(this._model);
|
||||
// Finally, focus ...
|
||||
var designer = commandContext._designer;
|
||||
designer.onObjectFocusEvent.attempt(relationship, designer);
|
||||
relationship.setOnFocus(true);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
|
@@ -35,6 +35,13 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
//sort childs by order
|
||||
var result = children.sort(function(n1, n2){
|
||||
if(n1.getOrder() && n2.getOrder())
|
||||
return n1.getOrder()>n2.getOrder();
|
||||
else
|
||||
return true;
|
||||
});
|
||||
delete node.getModel()._finalPosition;
|
||||
result = children;
|
||||
}
|
||||
|
@@ -24,6 +24,9 @@ mindplot.layoutManagers.boards.Board = new Class({
|
||||
},
|
||||
setNodeMarginTop:function(node, delta){
|
||||
core.assert(false, "no Board implementation found!");
|
||||
},
|
||||
getNode:function(){
|
||||
return this._node;
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -69,22 +69,6 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
|
||||
var nextEntry = result.table[1];
|
||||
nextEntry.setMarginTop((nextEntry.getPosition() - nextEntry.getTotalMarginTop())-pos.y);
|
||||
}
|
||||
var parent = node.getParent();
|
||||
if(!this._layoutManager._isCentralTopic(parent) && parent.getParent()!=null && (result.index == 0 || result.index==result.table.length-1)){
|
||||
var board = this._layoutManager.getTopicBoardForTopic(parent.getParent());
|
||||
var res2 = board.findNodeEntryIndex(parent);
|
||||
var parentEntry = res2.table[res2.index];
|
||||
var totalMarginTop = parentEntry.getTotalMarginTop();
|
||||
var totalMarginBottom = parentEntry.getTotalMarginBottom();
|
||||
var parentPosition = parentEntry.getPosition();
|
||||
if(result.index==0 && pos.y < parentPosition){
|
||||
var childrenMarginTop = parentEntry.getPosition()-(pos.y-entry.getTotalMarginTop());
|
||||
parentEntry.setMarginTop(totalMarginTop-childrenMarginTop);
|
||||
}else if(result.index==result.table.length-1 && pos.y>parentPosition){
|
||||
var childrenMarginBottom = (pos.y+entry.getTotalMarginBottom())-parentEntry.getPosition();
|
||||
parentEntry.setMarginBottom(totalMarginBottom - childrenMarginBottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._updateTable(result.index, result.table,modifiedTopics, false);
|
||||
this._layoutManager._updateParentBoard(node, modifiedTopics);
|
||||
|
Reference in New Issue
Block a user