Commit c9d67aef authored by Akikonata's avatar Akikonata

changed style

parent e48a1ef0
...@@ -3,7 +3,6 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -3,7 +3,6 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this.parent = null; this.parent = null;
this.children = []; this.children = [];
this.data = {}; this.data = {};
this._type = "main";
if ( Utils.isString( options ) ) { if ( Utils.isString( options ) ) {
this.setData( 'text', options ); this.setData( 'text', options );
} else { } else {
...@@ -22,10 +21,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -22,10 +21,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return this.getData( 'point' ); return this.getData( 'point' );
}, },
setType: function ( type ) { setType: function ( type ) {
this._type = type; this.setData( 'type', type );
}, },
getType: function ( type ) { getType: function ( type ) {
return this._type; return this.getData( 'type' );
}, },
setText: function ( text ) { setText: function ( text ) {
this.setData( 'text', text ); this.setData( 'text', text );
...@@ -216,9 +215,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -216,9 +215,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return true; return true;
}, },
getTextShape:function(){ getTextShape: function () {
var rc = this.getRenderContainer(); var rc = this.getRenderContainer();
var text = rc.getElementsByTagName('text'); var text = rc.getElementsByTagName( 'text' );
} }
} ); } );
\ No newline at end of file
...@@ -109,9 +109,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -109,9 +109,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
var connect = this._connect = new kity.Path(); var connect = this._connect = new kity.Path();
minder.getRenderContainer().addShape( connect ).bringTop( minder.getRoot().getRenderContainer() ); minder.getRenderContainer().addShape( connect ).bringTop( minder.getRoot().getRenderContainer() );
var Layout = { var Layout = {
stroke: new kity.Pen( "white", 1 ).setLineCap( "round" ), stroke: new kity.Pen( "white", 1 ).setLineCap( "round" ).setLineJoin( "round" ),
color: "white", color: "white",
padding: [ 5, 10, 5, 10 ], padding: [ 5, 10, 5.5, 10 ],
fontSize: 12, fontSize: 12,
margin: [ 0, 10, 20, 5 ], margin: [ 0, 10, 20, 5 ],
shape: this, shape: this,
...@@ -156,13 +156,13 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -156,13 +156,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
var nodeX, nodeY = Shape.getRenderBox().closurePoints[ 1 ].y; var nodeX, nodeY = Shape.getRenderBox().closurePoints[ 1 ].y;
if ( Layout.appendside === "left" ) { if ( Layout.appendside === "left" ) {
sX = parentBox.closurePoints[ 1 ].x - parentLayout.margin[ 1 ]; sX = parentBox.closurePoints[ 1 ].x - parentLayout.margin[ 1 ];
nodeX = Shape.getRenderBox().closurePoints[ 0 ].x - 1; nodeX = Shape.getRenderBox().closurePoints[ 0 ].x;
connect.getDrawer() connect.getDrawer()
.clear() .clear()
.moveTo( sX, sY ) .moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - Layout.margin[ 3 ] ) : ( nodeY + Layout.margin[ 3 ] ) ); .lineTo( sX, nodeY > sY ? ( nodeY - Layout.margin[ 3 ] ) : ( nodeY + Layout.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY ); if ( nodeY > sY ) connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY, 0, 1 );
else connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY, 0, 1 ); else connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY );
connect.stroke( Layout.stroke ); connect.stroke( Layout.stroke );
} else { } else {
sX = parentBox.closurePoints[ 0 ].x + parentLayout.margin[ 1 ]; sX = parentBox.closurePoints[ 0 ].x + parentLayout.margin[ 1 ];
...@@ -171,8 +171,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -171,8 +171,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
.clear() .clear()
.moveTo( sX, sY ) .moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - Layout.margin[ 3 ] ) : ( nodeY + Layout.margin[ 3 ] ) ); .lineTo( sX, nodeY > sY ? ( nodeY - Layout.margin[ 3 ] ) : ( nodeY + Layout.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY, 0, 1 ); if ( nodeY > sY ) connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY );
else connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY ); else connect.getDrawer().carcTo( Layout.margin[ 3 ], nodeX, nodeY, 0, 1 );
connect.stroke( Layout.stroke ); connect.stroke( Layout.stroke );
} }
}, },
...@@ -373,6 +373,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -373,6 +373,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
initStyle: function () { initStyle: function () {
//绘制root并且调整到正确位置 //绘制root并且调整到正确位置
var _root = this.getRoot(); var _root = this.getRoot();
minder.getRenderContainer().clear();
minder.handelNodeInsert( _root ); minder.handelNodeInsert( _root );
var rc = new RootShape( _root ); var rc = new RootShape( _root );
translateNode( _root ); translateNode( _root );
......
...@@ -68,6 +68,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -68,6 +68,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_root.preTraverse( function ( n ) { _root.preTraverse( function ( n ) {
n.clearLayout(); n.clearLayout();
n.setPoint(); n.setPoint();
n.getRenderContainer().clear();
} ); } );
km.setCurrentStyle( style ); km.setCurrentStyle( style );
km.initStyle(); km.initStyle();
......
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