Commit 78924b22 authored by Akikonata's avatar Akikonata

added getStyle

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