Commit b7a9e947 authored by Akikonata's avatar Akikonata

added node event

parent aeef6b0c
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div id="kityminder" style="height:1000px;width:100%" onselectstart="return false"> <div id="kityminder" style="height:1000px;width:100%" onselectstart="return false">
<select id="StyleChange"> <select id="StyleChange">
<option value="default">Default</option> <option value="default">Default</option>
<option value="green">Green</option> <option value="green" selected>Green</option>
</select> </select>
</div> </div>
</body> </body>
......
...@@ -430,7 +430,6 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -430,7 +430,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
drawNode( node ); drawNode( node );
}, },
initStyle: function () { initStyle: function () {
minder.getRenderContainer().clear();
//绘制root并且调整到正确位置 //绘制root并且调整到正确位置
var _root = this.getRoot(); var _root = this.getRoot();
minder.handelNodeInsert( _root ); minder.handelNodeInsert( _root );
...@@ -483,6 +482,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -483,6 +482,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
} }
var parentLayout = parent.getData( "layout" ); var parentLayout = parent.getData( "layout" );
var Layout = node.getData( "layout" ); var Layout = node.getData( "layout" );
this._fire( new MinderEvent( "beforeRenderNode", {
node: node
}, false ) );
if ( parent.getType() === "root" ) { if ( parent.getType() === "root" ) {
node.setType( "main" ); node.setType( "main" );
var leftList = parentLayout.leftList; var leftList = parentLayout.leftList;
...@@ -511,6 +513,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -511,6 +513,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout.appendside = parentLayout.appendside; Layout.appendside = parentLayout.appendside;
childbranch = new SubBranch( node ); childbranch = new SubBranch( node );
} }
this._fire( new MinderEvent( "afterRenderNode", {
node: node
}, false ) );
var set1 = updateLayoutVertical( node, parent, "append" ); var set1 = updateLayoutVertical( node, parent, "append" );
var set2 = updateLayoutHorizon( node ); var set2 = updateLayoutHorizon( node );
var set = uSet( set1, set2 ); var set = uSet( set1, set2 );
...@@ -543,7 +548,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -543,7 +548,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
while ( _buffer.length !== 0 ) { while ( _buffer.length !== 0 ) {
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() ); _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer[ 0 ].getData( "layout" ).shape.clear(); _buffer[ 0 ].getData( "layout" ).shape.clear();
_buffer[ 0 ].getRenderContainer().remove(); _buffer[ 0 ].handelNodeRemove();
var prt = _buffer[ 0 ].getParent(); var prt = _buffer[ 0 ].getParent();
prt.removeChild( _buffer[ 0 ] ); prt.removeChild( _buffer[ 0 ] );
_buffer.shift(); _buffer.shift();
......
This diff is collapsed.
...@@ -73,6 +73,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -73,6 +73,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_root.preTraverse( function ( n ) { _root.preTraverse( function ( n ) {
n.clearLayout(); n.clearLayout();
n.setPoint(); n.setPoint();
n.getRenderContainer().clear();
} ); } );
km.setCurrentStyle( style ); km.setCurrentStyle( style );
km.initStyle(); km.initStyle();
...@@ -151,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -151,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () {
} }
}, },
"defaultOptions": { "defaultOptions": {
"layoutstyle": "default" "layoutstyle": "green"
} }
}; };
} ); } );
\ No newline at end of file
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