Commit ac919779 authored by Akikonata's avatar Akikonata

修改了layout相关的字段,样式切换的时候统一清空“layout字段”

parent 14fba533
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
KityMinder.registerModule( "LayoutModule", function () {
kity.extendClass( MinderNode, {
setLayout: function ( k, v ) {
if ( this.setData( 'layout' ) === undefined ) {
this.setData( 'layout', {} );
}
var _pros = this.getLayout();
Utils.extend( _pros, {
k: v
} );
this.setData( 'layout', _pros );
},
getLayout: function ( k ) {
if ( k === undefined ) {
return this.getData( 'layout' );
}
return this.getData( 'layout' )[ k ];
},
clearLayout: function () {
this.setData( 'layout', {} );
this.getRenderContainer().clear();
},
updateLayout: function ( km ) {
km.updateLayout( this );
}
} );
var switchLayout = function ( km, style ) {
var _style = km.getLayoutStyle( style );
if ( !_style ) return false;
......@@ -7,13 +32,11 @@ KityMinder.registerModule( "LayoutModule", function () {
km.appendChildNode = _style.appendChildNode;
km.appendSiblingNode = _style.appendSiblingNode;
km.removeNode = _style.removeNode;
km.updateLayout = _style.updateLayout;
//清空节点上附加的数据
var _root = km.getRoot();
_root.preTraverse( function ( node ) {
node.setData( "style", {} );
node.setData( "shape", null );
node.getRenderContainer().clear();
node.clearLayout();
} );
km.initStyle();
return style;
......
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