Commit 2bf0eab8 authored by Akikonata's avatar Akikonata

recover icon func

parent 43a50557
......@@ -5,11 +5,15 @@ KityMinder.registerModule( "IconModule", function () {
var _number = new kity.Text().setContent( val ).fill( "white" ).setSize( 12 );
var _rc = new kity.Group();
_rc.addShapes( [ _bg, _number ] );
node.getIconRc().addShape( _rc );
node.getContRc().addShape( _rc );
_number.setTransform( new kity.Matrix().translate( 6, 15 ) );
var rcHeight = _rc.getHeight();
_rc.setTransform( new kity.Matrix().translate( 0, -rcHeight / 2 ) );
};
var renderProgressIcon = function ( node, val, left ) {
var renderProgressIcon = function ( node, val ) {
var _rc = new kity.Group();
var _contRc = node.getContRc();
var _bg = new kity.Circle().setRadius( 8 ).fill( "white" ).stroke( new kity.Pen( "#29A6BD", 2 ) );
var _percent, d;
if ( val < 5 ) {
......@@ -18,8 +22,7 @@ KityMinder.registerModule( "IconModule", function () {
d.moveTo( 0, 0 ).lineTo( 6, 0 );
} else _percent = new kity.Group();
_rc.addShapes( [ _bg, _percent ] );
node.getIconRc().addShape( _rc );
_rc.setTransform( new kity.Matrix().translate( left, 10 ) );
_contRc.addShape( _rc );
switch ( val ) {
case 1:
break;
......@@ -41,6 +44,7 @@ KityMinder.registerModule( "IconModule", function () {
}
if ( val < 5 ) d.close();
_percent.fill( "#29A6BD" );
_rc.setTransform( new kity.Matrix().translate( _contRc.getWidth() + 5, 0 ) );
};
var setPriorityCommand = kity.createClass( "SetPriorityCommand", ( function () {
return {
......@@ -91,26 +95,16 @@ KityMinder.registerModule( "IconModule", function () {
},
"events": {
"RenderNodeLeft": function ( e ) {
// var node = e.node;
// var iconRc = new kity.Group();
// 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 ) );
var node = e.node;
var PriorityIconVal = node.getData( "PriorityIcon" );
var ProgressIconVal = node.getData( "ProgressIcon" );
var contRc = node.getContRc();
if ( PriorityIconVal ) {
renderPriorityIcon( node, PriorityIconVal );
}
if ( ProgressIconVal ) {
renderProgressIcon( node, ProgressIconVal );
}
}
}
};
......
......@@ -514,19 +514,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( historyPoint ) {
_root.setPoint( historyPoint );
}
// var j = 0;
// var me = this;
// var ITV = window.setInterval( function () {
// for ( var k = 0; k < 0; k++ ) {
// me.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
// j++;
// if ( j === _cleanbuffer.length ) break;
// }
// if ( j === _cleanbuffer.length ) {
// window.clearInterval( ITV );
// }
// }, 0 );
//重组结构
for ( var j = 0; j < _cleanbuffer.length; j++ ) {
this.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
}
......@@ -544,6 +531,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout.appendside = siblingLayout.appendside;
Layout.align = siblingLayout.align;
if ( parent.getType() === "root" ) {
minder.handelNodeInsert( node );
var len = parent.getChildren().length;
if ( len < 7 ) {
if ( len % 2 ) {
......@@ -603,12 +591,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
//计算位置等流程
updateBg( node );
initLayout( node );
// this._fire( new MinderEvent( "beforeRenderNode", {
// node: node
// }, false ) );
// this._fire( new MinderEvent( "RenderNode", {
// node: node
// }, false ) );
this._firePharse( new MinderEvent( "RenderNodeLeft", {
node: node
}, false ) );
......
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