Commit 873f9122 authored by Akikonata's avatar Akikonata

fixed bug

parent d3b81471
KityMinder.registerModule( "fontmodule", function () { KityMinder.registerModule( "fontmodule", function () {
return { return {
defaultOptions:{ defaultOptions: {
'fontfamily': [ 'fontfamily': [ {
{ name: 'songti', val: '宋体,SimSun'}, name: 'songti',
{ name: 'yahei', val: '微软雅黑,Microsoft YaHei'}, val: '宋体,SimSun'
{ name: 'kaiti', val: '楷体,楷体_GB2312, SimKai'}, }, {
{ name: 'heiti', val: '黑体, SimHei'}, name: 'yahei',
{ name: 'lishu', val: '隶书, SimLi'}, val: '微软雅黑,Microsoft YaHei'
{ name: 'andaleMono', val: 'andale mono'}, }, {
{ name: 'arial', val: 'arial, helvetica,sans-serif'}, name: 'kaiti',
{ name: 'arialBlack', val: 'arial black,avant garde'}, val: '楷体,楷体_GB2312, SimKai'
{ name: 'comicSansMs', val: 'comic sans ms'}, }, {
{ name: 'impact', val: 'impact,chicago'}, name: 'heiti',
{ name: 'timesNewRoman', val: 'times new roman'}, val: '黑体, SimHei'
{ name: 'sans-serif',val:'sans-serif'} }, {
], name: 'lishu',
'fontsize': [10, 12, 16, 18,24, 32,48] val: '隶书, SimLi'
}, {
name: 'andaleMono',
val: 'andale mono'
}, {
name: 'arial',
val: 'arial, helvetica,sans-serif'
}, {
name: 'arialBlack',
val: 'arial black,avant garde'
}, {
name: 'comicSansMs',
val: 'comic sans ms'
}, {
name: 'impact',
val: 'impact,chicago'
}, {
name: 'timesNewRoman',
val: 'times new roman'
}, {
name: 'sans-serif',
val: 'sans-serif'
} ],
'fontsize': [ 10, 12, 16, 18, 24, 32, 48 ]
}, },
"commands": { "commands": {
"forecolor": kity.createClass( "fontcolorCommand", { "forecolor": kity.createClass( "fontcolorCommand", {
...@@ -39,7 +62,7 @@ KityMinder.registerModule( "fontmodule", function () { ...@@ -39,7 +62,7 @@ KityMinder.registerModule( "fontmodule", function () {
utils.each( nodes, function ( i, n ) { utils.each( nodes, function ( i, n ) {
n.setData( 'fontfamily', family ); n.setData( 'fontfamily', family );
n.getTextShape().setAttr( 'font-family', family ); n.getTextShape().setAttr( 'font-family', family );
km.updateLayout(n) km.updateLayout( n )
} ) } )
} }
} ), } ),
...@@ -50,8 +73,8 @@ KityMinder.registerModule( "fontmodule", function () { ...@@ -50,8 +73,8 @@ KityMinder.registerModule( "fontmodule", function () {
var nodes = km.getSelectedNodes(); var nodes = km.getSelectedNodes();
utils.each( nodes, function ( i, n ) { utils.each( nodes, function ( i, n ) {
n.setData( 'fontsize', size ); n.setData( 'fontsize', size );
n.getTextShape().setSize(size); n.getTextShape().setSize( size );
km.updateLayout(n) km.updateLayout( n )
} ) } )
} }
} ) } )
......
...@@ -107,15 +107,13 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -107,15 +107,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
switch ( node.getType() ) { switch ( node.getType() ) {
case "root": case "root":
case "main": case "main":
if ( !Layout.bgRect ) { node.getBgRc().clear().addShape( Layout.bgRect = new kity.Rect() );
node.getBgRc().addShape( Layout.bgRect = new kity.Rect() );
}
Layout.bgRect.fill( nodeStyle.fill ).setRadius( nodeStyle.radius ); Layout.bgRect.fill( nodeStyle.fill ).setRadius( nodeStyle.radius );
break; break;
case "sub": case "sub":
var underline = Layout.underline = new kity.Path(); var underline = Layout.underline = new kity.Path();
var highlightshape = Layout.highlightshape = new kity.Rect(); var highlightshape = Layout.highlightshape = new kity.Rect();
node.getBgRc().addShapes( [ highlightshape, underline ] ); node.getBgRc().clear().addShapes( [ highlightshape, underline ] );
break; break;
default: default:
break; break;
...@@ -419,6 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -419,6 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
//设置root的align //设置root的align
_root.getData( "layout" ).align = "center"; _root.getData( "layout" ).align = "center";
updateBg( _root ); updateBg( _root );
console.log( _root.getData( "layout" ), _root.getRenderContainer() );
initLayout( _root ); initLayout( _root );
this._fire( new MinderEvent( "beforeRenderNode", { this._fire( new MinderEvent( "beforeRenderNode", {
node: _root node: _root
...@@ -562,46 +561,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -562,46 +561,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
translateNode( set[ i ] ); translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] ); updateConnectAndshIcon( set[ i ] );
} }
} }
}; };
this.addLayoutStyle( "default", _style ); this.addLayoutStyle( "default", _style );
return { return {};
// "events": {
// "click": function ( e ) {
// var ico = e.kityEvent.targetShape.container;
// if ( ico.class === "shicon" ) {
// var isShow = ico.icon.switchState();
// var node = ico.icon._node;
// var _buffer;
// if ( isShow ) {
// _buffer = node.getChildren();
// while ( _buffer.length !== 0 ) {
// minder.appendChildNode( _buffer[ 0 ].getParent(), _buffer[ 0 ] );
// _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
// _buffer.shift();
// }
// } else {
// var Layout = node.getData( "layout" );
// var marginTop = Layout.margin[ 0 ];
// var marginBottom = Layout.margin[ 2 ];
// Layout.branchheight = node.getRenderContainer().getHeight() + marginTop + marginBottom;
// _buffer = node.getChildren();
// while ( _buffer.length !== 0 ) {
// try {
// _buffer[ 0 ].getData( "layout" ).shape.clear();
// _buffer[ 0 ].getRenderContainer().remove();
// } catch ( error ) {}
// _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
// _buffer.shift();
// }
// var set = updateLayoutVertical( node, node.getParent(), "append" );
// for ( var i = 0; i < set.length; i++ ) {
// translateNode( set[ i ] );
// }
// }
// }
// }
// }
};
} ); } );
\ No newline at end of file
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