Commit 7ee1cf20 authored by Akikonata's avatar Akikonata

added node move

parent 10f21447
Subproject commit 8b33f729a570f3501769d16ad4c329c0e7f4e08d Subproject commit cfe7d5a248f0634d85dab3e51dc2d90d2d23ac5e
...@@ -355,12 +355,19 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -355,12 +355,19 @@ KityMinder.registerModule( "LayoutDefault", function () {
//以某个节点为seed对水平方向进行调整(包括调整子树) //以某个节点为seed对水平方向进行调整(包括调整子树)
var updateLayoutHorizon = function ( node ) { var updateLayoutHorizon = function ( node ) {
var nodeLayout = node.getData( "layout" ); var effectSet = []; //返回受影响(即需要进行下一步translate的节点)
var effectSet = [ node ]; //返回受影响(即需要进行下一步translate的节点) var _buffer = [ node ];
var parent = node.getParent(); while ( _buffer.length !== 0 ) {
var parent = _buffer[ 0 ].getParent();
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
if ( !parent ) {
_buffer.shift();
continue;
}
var nodeLayout = _buffer[ 0 ].getData( "layout" );
var appendside = nodeLayout.appendside; var appendside = nodeLayout.appendside;
var selfWidth = node.getRenderContainer().getWidth(); var selfWidth = _buffer[ 0 ].getRenderContainer().getWidth();
if ( parent ) {
var parentLayout = parent.getData( "layout" ); var parentLayout = parent.getData( "layout" );
var parentWidth = parent.getRenderContainer().getWidth(); var parentWidth = parent.getRenderContainer().getWidth();
if ( parentLayout.align === "center" ) parentWidth = parentWidth / 2; if ( parentLayout.align === "center" ) parentWidth = parentWidth / 2;
...@@ -376,6 +383,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -376,6 +383,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
default: default:
break; break;
} }
effectSet.push( _buffer[ 0 ] );
_buffer.shift();
} }
return effectSet; return effectSet;
}; };
......
...@@ -421,7 +421,6 @@ KityMinder.registerModule( "LayoutGreen", function () { ...@@ -421,7 +421,6 @@ KityMinder.registerModule( "LayoutGreen", function () {
initStyle: function () { initStyle: function () {
//绘制root并且调整到正确位置 //绘制root并且调整到正确位置
var _root = this.getRoot(); var _root = this.getRoot();
minder.getRenderContainer().clear();
minder.handelNodeInsert( _root ); minder.handelNodeInsert( _root );
var rc = new RootShape( _root ); var rc = new RootShape( _root );
translateNode( _root ); translateNode( _root );
......
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