Commit 47d3b6f5 authored by Akikonata's avatar Akikonata

重构

parent 6b68f6ec
......@@ -25,15 +25,7 @@
</body>
<script>
var minder = KM.createMinder(kityminder);
document.getElementById("StyleChange").addEventListener("change",function(e){
var val = e.target.value;
minder.execCommand("switchlayout",val);
},false);
minder.select(minder.getRoot());
var node = new KM.MinderNode('test');
node.setData('fontcolor','red');
minder.execCommand('appendChildNode',node);
// var b = new kity.Bezier([new kity.BezierPoint(0,0).setVertex(100,100),new kity.BezierPoint(100,0).setVertex(100,100)]);
// minder.getRenderContainer().addShape(b.stroke("white"));
minder.getRoot().setData('fontcolor','red');
minder.updateLayout(minder.getRoot());
</script>
</html>
\ No newline at end of file
Subproject commit cfe7d5a248f0634d85dab3e51dc2d90d2d23ac5e
Subproject commit 1bfcdd712725d25d54bfe88d0ee0fac6ee33830a
......@@ -2,12 +2,12 @@
kity.extendClass( Minder, function () {
function highlightNode( km, node ) {
node.setData( "highlight", true );
km.renderNode( node );
km.highlightNode( node );
}
function unhighlightNode( km, node ) {
node.setData( "highlight", false );
km.renderNode( node );
km.highlightNode( node );
}
return {
_initSelection: function () {
......
......@@ -8,8 +8,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
} else {
this.setData( options );
}
this._createShapeDom()
this._createShapeDom();
this.setData( "layout", {} );
},
_createShapeDom: function () {
this.rc = new kity.Group();
......@@ -26,10 +26,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this.rc.appendShape( g );
},
_createBgGroup: function () {
this._createGroup( 'bgrc' )
this._createGroup( 'bgrc' );
},
_createContGroup: function () {
this._createGroup( 'contrc' )
this._createGroup( 'contrc' );
},
_createTextShape: function () {
this.getContRc().appendShape( new kity.Text( this.getData( 'text' ) || '' ) );
......@@ -37,24 +37,24 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
getContRc: function () {
var groups = this.rc.getShapesByType( 'group' ),
result;
utils.each( groups, function ( i, p ) {
Utils.each( groups, function ( i, p ) {
if ( p.getData( 'rctype' ) == 'contrc' ) {
result = p;
return false;
}
} );
return result
return result;
},
getBgRc: function () {
var groups = this.rc.getShapesByType( 'group' ),
result;
utils.each( groups, function ( i, p ) {
Utils.each( groups, function ( i, p ) {
if ( p.getData( 'rctype' ) == 'bgrc' ) {
result = p;
return false;
}
} );
return result
return result;
},
setPoint: function ( x, y ) {
this.setData( 'point', {
......
This diff is collapsed.
......@@ -35,6 +35,7 @@ KityMinder.registerModule( "fontmodule", function () {
e.node.getTextShape().setAttr( 'font-family', val );
}
if ( val = e.node.getData( 'fontcolor' ) ) {
console.log( val );
e.node.getTextShape().fill( val );
}
}
......
This diff is collapsed.
......@@ -16,9 +16,9 @@ KityMinder.registerModule( "LayoutModule", function () {
_root.setData( "currentstyle", name );
return name;
},
renderNode: function ( node ) {
highlightNode: function ( node ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).renderNode.call( this, node );
this.getLayoutStyle( curStyle ).highlightNode.call( this, node );
},
initStyle: function () {
var curStyle = this.getCurrentStyle();
......
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