Commit 7fff75b2 authored by campaign's avatar campaign

by zhanyi01

parent b5dc9fc3
...@@ -388,7 +388,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -388,7 +388,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}, },
_createTextShape: function () { _createTextShape: function () {
var textShape = new kity.Text( this.getData( 'text' ) || '' ); var textShape = new kity.Text( this.getData( 'text' ) || '' );
textShape.setAttr('_nodeTextShape',true); textShape.setAttr( '_nodeTextShape', true );
this.getContRc().appendShape( textShape ); this.getContRc().appendShape( textShape );
}, },
_createIconShape: function () { _createIconShape: function () {
...@@ -422,10 +422,14 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -422,10 +422,14 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return this._iconRc; return this._iconRc;
}, },
setPoint: function ( x, y ) { setPoint: function ( x, y ) {
if ( arguments.length < 2 ) {
this.setData( "point", x );
} else {
this.setData( 'point', { this.setData( 'point', {
x: x, x: x,
y: y y: y
} ); } );
}
}, },
getPoint: function () { getPoint: function () {
return this.getData( 'point' ); return this.getData( 'point' );
...@@ -657,12 +661,12 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -657,12 +661,12 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}, },
getTextShape: function () { getTextShape: function () {
var textShape; var textShape;
utils.each(this.getContRc().getShapesByType( 'text' ),function(i,t){ utils.each( this.getContRc().getShapesByType( 'text' ), function ( i, t ) {
if(t.getAttr('_nodeTextShape')){ if ( t.getAttr( '_nodeTextShape' ) ) {
textShape = t; textShape = t;
return false; return false;
} }
}); } );
return textShape; return textShape;
}, },
isSelected: function () { isSelected: function () {
...@@ -2296,7 +2300,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2296,7 +2300,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
childLayout.y = sY + childLayout.branchheight / 2; childLayout.y = sY + childLayout.branchheight / 2;
sY += childLayout.branchheight; sY += childLayout.branchheight;
} }
effectSet.push( _buffer[ 0 ] ); if ( _buffer[ 0 ] !== root ) effectSet.push( _buffer[ 0 ] );
_buffer.shift(); _buffer.shift();
} }
} }
...@@ -2479,6 +2483,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2479,6 +2483,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
}, },
initStyle: function () { initStyle: function () {
var _root = minder.getRoot(); var _root = minder.getRoot();
var historyPoint = _root.getPoint();
if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) );
minder.handelNodeInsert( _root ); minder.handelNodeInsert( _root );
//设置root的align //设置root的align
_root.getLayout().align = "center"; _root.getLayout().align = "center";
...@@ -2507,10 +2513,14 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2507,10 +2513,14 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( _buffer[ 0 ] !== _root ) _cleanbuffer.push( _buffer[ 0 ] ); if ( _buffer[ 0 ] !== _root ) _cleanbuffer.push( _buffer[ 0 ] );
_buffer.shift(); _buffer.shift();
} }
if ( historyPoint ) {
_root.setPoint( historyPoint );
}
//重组结构 //重组结构
for ( var j = 0; j < _cleanbuffer.length; j++ ) { for ( var j = 0; j < _cleanbuffer.length; j++ ) {
this.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] ); this.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
} }
_root.setPoint( _root.getLayout().x, _root.getLayout().y );
}, },
appendChildNode: function ( parent, node, sibling ) { appendChildNode: function ( parent, node, sibling ) {
minder.handelNodeInsert( node ); minder.handelNodeInsert( node );
...@@ -2546,7 +2556,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2546,7 +2556,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} else { } else {
var nodeP = node.getPoint(); var nodeP = node.getPoint();
if ( nodeP && nodeP.x && nodeP.y ) { if ( nodeP && nodeP.x && nodeP.y ) {
if ( nodeP.x > parentLayout.x ) { if ( nodeP.x > parent.getPoint().x ) {
Layout.appendside = "right"; Layout.appendside = "right";
Layout.align = "left"; Layout.align = "left";
} else { } else {
...@@ -4304,6 +4314,9 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -4304,6 +4314,9 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setHide(); sel.setHide();
receiver.clear().setTextEditStatus(false); receiver.clear().setTextEditStatus(false);
}, },
"resize": function ( e ) {
sel.setHide();
},
'execCommand':function(e){ 'execCommand':function(e){
var cmds = { var cmds = {
'appendchildnode':1, 'appendchildnode':1,
......
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