Commit b7a9e947 authored by Akikonata's avatar Akikonata

added node event

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