Commit 5427c7b0 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents be565a30 d3a35581
...@@ -510,7 +510,6 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -510,7 +510,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
}, },
initStyle: function ( expandall ) { initStyle: function ( expandall ) {
var _root = minder.getRoot(); var _root = minder.getRoot();
//debugger;
var historyPoint = _root.getPoint(); var historyPoint = _root.getPoint();
if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) ); if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) );
minder.handelNodeInsert( _root ); minder.handelNodeInsert( _root );
...@@ -581,22 +580,11 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -581,22 +580,11 @@ KityMinder.registerModule( "LayoutDefault", function () {
_root.setPoint( _root.getLayout().x, _root.getLayout().y ); _root.setPoint( _root.getLayout().x, _root.getLayout().y );
}, },
appendChildNode: function ( parent, node, focus, sibling ) { appendChildNode: function ( parent, node, focus, sibling ) {
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getLayout().expand === false ) {
minder.expandNode( parent );
}
minder.handelNodeInsert( node ); minder.handelNodeInsert( node );
var Layout = node.getLayout();
var oldExpand;
if ( Layout ) {
oldExpand = Layout.expand;
}
if ( oldExpand ) {
alert( 'aru' );
}
node.clearLayout(); node.clearLayout();
node.getContRc().clear(); node.getContRc().clear();
Layout = node.getLayout(); var Layout = node.getLayout();
Layout.expand = oldExpand || false; Layout.expand = false;
if ( parent.getType() !== 'root' ) { if ( parent.getType() !== 'root' ) {
parent.getLayout().expand = true; parent.getLayout().expand = true;
} }
......
KityMinder.registerModule( "LayoutModule", function () { KityMinder.registerModule( "LayoutModule", function () {
var me = this;
var clearPaper = function () {
me._rc.remove();
me._rc = new kity.Group();
me._paper.addShape( this._rc );
};
kity.extendClass( Minder, { kity.extendClass( Minder, {
addLayoutStyle: function ( name, style ) { addLayoutStyle: function ( name, style ) {
if ( !this._layoutStyles ) this._layoutStyles = {}; if ( !this._layoutStyles ) this._layoutStyles = {};
...@@ -45,6 +51,11 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -45,6 +51,11 @@ KityMinder.registerModule( "LayoutModule", function () {
this.getLayoutStyle( curStyle ).initStyle.call( this, expandall ); this.getLayoutStyle( curStyle ).initStyle.call( this, expandall );
this.fire( 'afterinitstyle' ); this.fire( 'afterinitstyle' );
}, },
restoreStyle: function () {
var curStyle = this.getCurrentStyle();
clearPaper();
var _root = this.getRoot();
},
appendChildNode: function ( parent, node, focus, index ) { appendChildNode: function ( parent, node, focus, index ) {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).appendChildNode.call( this, parent, node, focus, index ); this.getLayoutStyle( curStyle ).appendChildNode.call( this, parent, node, focus, index );
...@@ -115,7 +126,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -115,7 +126,7 @@ KityMinder.registerModule( "LayoutModule", function () {
if ( !parent ) { if ( !parent ) {
return null; return null;
} }
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) { if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getLayout().expand === false ) {
km.expandNode( parent ); km.expandNode( parent );
} }
...@@ -251,12 +262,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -251,12 +262,7 @@ KityMinder.registerModule( "LayoutModule", function () {
"cloneNode": function ( e ) { "cloneNode": function ( e ) {
var target = e.targetNode; var target = e.targetNode;
var source = e.sourceNode; var source = e.sourceNode;
target.clearLayout(); target._layout = utils.extend( {}, source._layout );
var sourceLayout = source.getLayout();
var targetLayout = target.getLayout();
targetLayout.expand = utils.clone(sourceLayout.expand);
console.log( targetLayout );
} }
}, },
'contextmenu': [ { 'contextmenu': [ {
......
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