Commit ae81c95e authored by Akikonata's avatar Akikonata

dev

parent 6fbd73c8
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<script src="../kity/dist/kitygraph.all.js"></script> <script src="../kity/dist/kitygraph.all.js"></script>
<script src="../dist/dev.php"></script> <script src="../dist/dev.php"></script>
</head> </head>
<body> <body style="background:#262626">
</body> </body>
<script> <script>
......
...@@ -164,7 +164,7 @@ kity.extendClass( KityMinder, { ...@@ -164,7 +164,7 @@ kity.extendClass( KityMinder, {
}, },
update: function ( node ) { update: function ( node ) {
this.execCommand( 'render', node ); this.execCommand( 'renderroot', node );
return this; return this;
} }
} ); } );
...@@ -186,7 +186,7 @@ kity.extendClass( KityMinder, { ...@@ -186,7 +186,7 @@ kity.extendClass( KityMinder, {
var listen = function ( name, callback ) { var listen = function ( name, callback ) {
if ( window.addEventListener ) { if ( window.addEventListener ) {
window.addEventListener( name, callback ); window.addEventListener( name, callback );
} else if ( window.attachEvent ) { } else if ( window.attachEvent ) {
window.attachEvent( name, callback ); window.attachEvent( name, callback );
} }
}; };
......
KityMinder.registerModule( "RenderModule", ( function () { KityMinder.registerModule( "RenderModule", function () {
var RenderRootCommand = kity.createClass( "RenderRootCommand", ( function () { var RenderRootCommand = kity.createClass( "RenderRootCommand", ( function () {
var node_default = { var node_default = {
x: 0, x: 0,
...@@ -6,24 +6,33 @@ KityMinder.registerModule( "RenderModule", ( function () { ...@@ -6,24 +6,33 @@ KityMinder.registerModule( "RenderModule", ( function () {
radius: 5, radius: 5,
text: "Root", text: "Root",
fill: "#7ecef4", fill: "#7ecef4",
stroke: "white" stroke: "white",
padding: 5
}; };
var drawRectNode = function ( kR, node ) { var drawRectNode = function ( node ) {
if ( !node ) { if ( !node ) {
node = node_default; node = node_default;
} }
var _node = new kity.Group();
var _rect = new kity.Rect(); var _rect = new kity.Rect();
_rect.setRadius( node.radius ); var _text = new kity.Text( node.text );
return _rect; _rect
.setRadius( node.radius )
.setSize( 100, 100 )
.setPosition( 20, 20 )
.fill( node.fill )
.stroke( node.stroke );
_node.addItems( [ _rect, _text ] );
return _node;
}; };
return { return {
base: Command, base: Command,
execute: function ( km, node ) { execute: function ( km, node ) {
var kR = km.getRenderContainer(); var kR = km.getRenderContainer();
var _root = km.getRoot() || new MinderNode(); var _root = km.getRoot() || new MinderNode();
var shape = new kity.Group(); var _node = drawRectNode( node );
var _rect = drawRectNode( node ); console.log( _node );
shape.addShape( _rect, "background" ); kR.addShape( _node, "background" );
} }
}; };
} )() ); } )() );
...@@ -73,4 +82,4 @@ KityMinder.registerModule( "RenderModule", ( function () { ...@@ -73,4 +82,4 @@ KityMinder.registerModule( "RenderModule", ( function () {
} }
} }
}; };
} ); } );
\ No newline at end of file \ 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