Commit 78924b22 authored by Akikonata's avatar Akikonata

added getStyle

parent be542bcb
...@@ -19,8 +19,6 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -19,8 +19,6 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this._createBgGroup(); this._createBgGroup();
this._createContGroup(); this._createContGroup();
this._createIconShape();
this._createTextShape();
}, },
_createGroup: function ( type ) { _createGroup: function ( type ) {
var g = new kity.Group(); var g = new kity.Group();
...@@ -38,11 +36,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -38,11 +36,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
textShape.setAttr( '_nodeTextShape', true ); textShape.setAttr( '_nodeTextShape', true );
this.getContRc().appendShape( textShape ); this.getContRc().appendShape( textShape );
}, },
_createIconShape: function () { // _createIconShape: function () {
var g = new kity.Group(); // var g = new kity.Group();
this.getContRc().appendShape( g ); // this.getContRc().appendShape( g );
this._iconRc = g; // this._iconRc = g;
}, // },
getContRc: function () { getContRc: function () {
var groups = this.rc.getShapesByType( 'group' ), var groups = this.rc.getShapesByType( 'group' ),
result; result;
...@@ -65,9 +63,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -65,9 +63,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
} ); } );
return result; return result;
}, },
getIconRc: function () { // getIconRc: function () {
return this._iconRc; // return this._iconRc;
}, // },
setPoint: function ( x, y ) { setPoint: function ( x, y ) {
if ( arguments.length < 2 ) { if ( arguments.length < 2 ) {
this.setData( "point", x ); this.setData( "point", x );
......
...@@ -91,26 +91,27 @@ KityMinder.registerModule( "IconModule", function () { ...@@ -91,26 +91,27 @@ KityMinder.registerModule( "IconModule", function () {
}, },
"events": { "events": {
"RenderNodeLeft": function ( e ) { "RenderNodeLeft": function ( e ) {
var node = e.node; //alert( '111111' );
var iconRc = node.getIconRc(); // var node = e.node;
var contRc = node.getContRc(); // var iconRc = node.getIconRc();
var PriorityIconVal = node.getData( "PriorityIcon" ); // var contRc = node.getContRc();
var ProgressIconVal = node.getData( "ProgressIcon" ); // var PriorityIconVal = node.getData( "PriorityIcon" );
//依次排布图标、文字 // var ProgressIconVal = node.getData( "ProgressIcon" );
iconRc.clear(); // //依次排布图标、文字
var PriorityIconWidth = 0; // iconRc.clear();
if ( PriorityIconVal ) { // var PriorityIconWidth = 0;
renderPriorityIcon( node, PriorityIconVal ); // if ( PriorityIconVal ) {
PriorityIconWidth = 22; // renderPriorityIcon( node, PriorityIconVal );
} // PriorityIconWidth = 22;
if ( ProgressIconVal ) { // }
renderProgressIcon( node, ProgressIconVal, PriorityIconWidth + 10 ); // if ( ProgressIconVal ) {
} // renderProgressIcon( node, ProgressIconVal, PriorityIconWidth + 10 );
var iconWidth = iconRc.getWidth(); // }
var textShape = node.getTextShape(); // var iconWidth = iconRc.getWidth();
if ( iconWidth ) textShape.setTransform( new kity.Matrix().translate( iconWidth + 5, 0 ) ); // var textShape = node.getTextShape();
else textShape.setTransform( new kity.Matrix().translate( 0, 0 ) ); // if ( iconWidth ) textShape.setTransform( new kity.Matrix().translate( iconWidth + 5, 0 ) );
iconRc.setTransform( new kity.Matrix().translate( 0, -( iconRc.getHeight() + textShape.getHeight() ) / 2 ) ); // else textShape.setTransform( new kity.Matrix().translate( 0, 0 ) );
// iconRc.setTransform( new kity.Matrix().translate( 0, -( iconRc.getHeight() + textShape.getHeight() ) / 2 ) );
} }
} }
}; };
......
...@@ -123,8 +123,8 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -123,8 +123,8 @@ KityMinder.registerModule( "LayoutBottom", function () {
var Layout = node.getLayout(); var Layout = node.getLayout();
var nodeType = node.getType(); var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ]; var nodeStyle = nodeStyles[ nodeType ];
var txtShape = node.getTextShape(); // var txtShape = node.getTextShape();
txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 ); // txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 );
if ( nodeType === "main" ) { if ( nodeType === "main" ) {
var subgroup = Layout.subgroup = new kity.Group(); var subgroup = Layout.subgroup = new kity.Group();
minder.getRenderContainer().addShape( subgroup ); minder.getRenderContainer().addShape( subgroup );
...@@ -330,6 +330,9 @@ KityMinder.registerModule( "LayoutBottom", function () { ...@@ -330,6 +330,9 @@ KityMinder.registerModule( "LayoutBottom", function () {
} }
}; };
var _style = { var _style = {
getCurrentLayoutStyle: function () {
return nodeStyles;
},
highlightNode: function ( node ) { highlightNode: function ( node ) {
var highlight = node.isHighlight(); var highlight = node.isHighlight();
var nodeType = node.getType(); var nodeType = node.getType();
......
...@@ -133,8 +133,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -133,8 +133,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
var Layout = node.getLayout(); var Layout = node.getLayout();
var nodeType = node.getType(); var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ]; var nodeStyle = nodeStyles[ nodeType ];
var txtShape = node.getTextShape(); //var txtShape = node.getTextShape();
txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 ); //txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 );
if ( nodeType === "root" ) { if ( nodeType === "root" ) {
Layout.leftList = []; Layout.leftList = [];
Layout.rightList = []; Layout.rightList = [];
...@@ -409,6 +409,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -409,6 +409,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
}; };
var _style = { var _style = {
getCurrentLayoutStyle: function () {
return nodeStyles;
},
highlightNode: function ( node ) { highlightNode: function ( node ) {
var highlight = node.isHighlight(); var highlight = node.isHighlight();
var nodeType = node.getType(); var nodeType = node.getType();
......
...@@ -7,6 +7,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -7,6 +7,7 @@ KityMinder.registerModule( "LayoutModule", function () {
getLayoutStyle: function ( name ) { getLayoutStyle: function ( name ) {
return this._layoutStyles[ name ]; return this._layoutStyles[ name ];
}, },
getLayoutStyleItems: function () { getLayoutStyleItems: function () {
var items = []; var items = [];
for ( var key in this._layoutStyles ) { for ( var key in this._layoutStyles ) {
...@@ -23,6 +24,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -23,6 +24,9 @@ KityMinder.registerModule( "LayoutModule", function () {
_root.setData( "currentstyle", name ); _root.setData( "currentstyle", name );
return name; return name;
}, },
getCurrentLayoutStyle: function () {
this.getLayoutStyle( curStyle ).getCurrentLayoutStyle.call( this );
},
highlightNode: function ( node ) { highlightNode: function ( node ) {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).highlightNode.call( this, node ); this.getLayoutStyle( curStyle ).highlightNode.call( this, node );
......
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