Commit ca60958e authored by campaign's avatar campaign

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

parents c4f5c210 ac919779
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
KityMinder.registerModule( "LayoutModule", function () { 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 switchLayout = function ( km, style ) {
var _style = km.getLayoutStyle( style ); var _style = km.getLayoutStyle( style );
if ( !_style ) return false; if ( !_style ) return false;
...@@ -7,13 +32,11 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -7,13 +32,11 @@ KityMinder.registerModule( "LayoutModule", function () {
km.appendChildNode = _style.appendChildNode; km.appendChildNode = _style.appendChildNode;
km.appendSiblingNode = _style.appendSiblingNode; km.appendSiblingNode = _style.appendSiblingNode;
km.removeNode = _style.removeNode; km.removeNode = _style.removeNode;
km.updateLayout = _style.updateLayout;
//清空节点上附加的数据 //清空节点上附加的数据
var _root = km.getRoot(); var _root = km.getRoot();
_root.preTraverse( function ( node ) { _root.preTraverse( function ( node ) {
node.setData( "style", {} ); node.clearLayout();
node.setData( "shape", null );
node.getRenderContainer().clear();
} ); } );
km.initStyle(); km.initStyle();
return style; 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