Commit 0718e9b6 authored by Akikonata's avatar Akikonata

deleted extra files

parent 901b665d
......@@ -167,28 +167,8 @@ kity.extendClass( KityMinder, {
},
update: function ( node ) {
node = node || this._root;
this.traverse( node, function ( current ) {
var rc = current.getRenderContainer();
var x = current.getData( 'x' ) || 0,
y = current.getData( 'y' ) || 0;
rc.setTransform( new kity.Matrix().translate( x, y ) );
if ( !rc.rect ) {
rc.rect = new kity.Rect();
rc.addShape( rc.rect );
rc.rect.fill( '#eee' );
rc.rect.setRadius( 5 );
}
if ( !rc.text ) {
rc.text = new kity.Text();
rc.addShape( rc.text );
}
rc.text.setContent( current.getData( 'text' ) || '' );
var box = rc.text.getRenderBox();
rc.rect.setPosition( box.x - 5, box.y - 5 );
rc.rect.setSize( box.width + 10, box.height + 10 );
} );
this.execCommand( 'render', node );
return this;
}
} );
......
......@@ -2,15 +2,37 @@ KityMinder.registerModule( "RenderModule", function () {
var DrawShapeCommand = kity.createClass( "DrawShapeCommand", {
base: Command,
execute: function ( km, config ) {
execute: function ( km, node ) {
var dR = km.getRenderContainer();
node = node || km.getRoot();
km.traverse( node, function ( current ) {
var rc = current.getRenderContainer();
var x = current.getData( 'x' ) || 0,
y = current.getData( 'y' ) || 0;
rc.setTransform( new kity.Matrix().translate( x, y ) );
if ( !rc.rect ) {
rc.rect = new kity.Rect();
rc.addShape( rc.rect );
rc.rect.fill( '#eee' );
rc.rect.setRadius( 5 );
}
if ( !rc.text ) {
rc.text = new kity.Text();
rc.addShape( rc.text );
}
rc.text.setContent( current.getData( 'text' ) || '' );
var box = rc.text.getRenderBox();
rc.rect.setPosition( box.x - 5, box.y - 5 );
rc.rect.setSize( box.width + 10, box.height + 10 );
} );
}
} );
return {
"commands": {
//todo:command字典,name-action 键值对模式编写
"drawrect": DrawShapeCommand
"render": DrawShapeCommand
},
"events": {
......
<!DOCTYPE html>
<html>
<head>
<title>KM Loader</title>
<style>
body, div, html {
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
</body>
<script src="../kity/dist/kitygraph.all.js"></script>
<script src="../src/core/command.js"></script>
<script src="../minder_module/module.test.js"></script>
<script src="../minder_module/module.default.test.js"></script>
<script src="../src/core/km.js"></script>
<script src="../src/core/minderevent.js"></script>
<script src="../src/core/mindernode.js"></script>
<script src="../src/core/kityminder.js"></script>
<script>
KityMinder.registerModule("test",mindermoduleTest);
KityMinder.registerModule("defaulttest",mindermoduleDefaultTest);
var myMinder = new KityMinder();
myMinder.execCommand("testCommand","test1",function(){alert(a)},{a:1,b:2});
myMinder.execCommand("testCommand1");
console.log(myMinder.queryCommandState("testCommand"));
console.log(myMinder.queryCommandValue("testCommand"));
</script>
</html>
\ 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