Commit 1cc974e2 authored by techird's avatar techird

Merge branch 'dev' of https://github.com/kitygraph/kityminder into dev

Conflicts:
	src/module/keyboard.js
parents a93ab56d 99d733da
KityMinder.registerModule( "LayoutModule", function () { KityMinder.registerModule( "LayoutModule", function () {
var createChildNode = function ( km, parent ) { var createChildNode = function ( km, parent ) {
var children = parent.getChildren();
var _node = new MinderNode(); var _node = new MinderNode();
_node.setData( "y", Math.random() * 300 + 100 ); _node.setData( "y", parent.getData( "y" ) + Math.random() * 100 - 100 );
_node.setData( "text", "New Node" ); _node.setData( "text", "New Node" );
switch ( parent.branchside ) { switch ( parent.getData( "branchside" ) ) {
case "left": case "left":
_node.setData( "branchside", "left" );
_node.setData( "x", parent.getData( "x" ) - 200 );
break; break;
case "right": case "right":
_node.setData( "x", parent.getData( "x" ) + 200 );
_node.setData( "branchside", "right" );
break; break;
default: default:
( function () { ( function () {
var children = parent.getChildren();
if ( children.length < 5 ) { if ( children.length < 5 ) {
_node.setData( "x", parent.getData( "x" ) + 200 ); _node.setData( "x", parent.getData( "x" ) + 200 );
_node.setData( "align", "left" ); _node.setData( "align", "right" );
_node.setData( "branchside", "right" );
} else { } else {
_node.setData( "x", parent.getData( "x" ) - 200 ); _node.setData( "x", parent.getData( "x" ) - 200 );
_node.setData( "align", "right" ); _node.setData( "align", "left" );
_node.setData( "branchside", "left" );
} }
} )(); } )();
break; break;
...@@ -41,6 +47,8 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -41,6 +47,8 @@ KityMinder.registerModule( "LayoutModule", function () {
var parent = sibling.getParent(); var parent = sibling.getParent();
if ( parent ) { if ( parent ) {
return createChildNode( km, parent ); return createChildNode( km, parent );
} else {
return false;
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment