Commit ae6c0298 authored by Akikonata's avatar Akikonata

dev

parent ae81c95e
...@@ -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 style="background:#262626"> <body style="background:#262626; margin:0; padding:0">
</body> </body>
<script> <script>
......
var Command = kity.createClass( "Command", { var Command = kity.createClass( "Command", ( function () {
var _isContentChange = true;
var _isSelectionChange = false;
return {
constructor: function () { constructor: function () {
}, },
execute: function ( minder, args ) { execute: function ( minder, args ) {
}, },
revert: function () { revert: function () {
}, },
setContentChanged: function ( val ) { setContentChanged: function ( val ) {
_isContentChange = typeof ( val ) === "boolean" ? val : _isContentChange;
},
}, isContentChanged: function () {
return _isContentChange;
},
isContentChanged: function () { setSelectionChanged: function ( val ) {
return true; _isSelectionChange = typeof ( val ) === "boolean" ? val : _isSelectionChange;
}, },
setSelectionChanged: function ( val ) { isSelectionChanged: function () {
return _isSelectionChange;
},
}, queryState: function ( km ) {
return 0;
},
isSelectionChanged: function () { queryValue: function ( km ) {
return false; return 0;
}, }
};
queryState: function ( km ) { } )() );
return 0; \ No newline at end of file
},
queryValue: function ( km ) {
return 0;
}
} );
\ No newline at end of file
...@@ -20,6 +20,10 @@ var KityMinder = km.KityMinder = kity.createClass( "KityMinder", { ...@@ -20,6 +20,10 @@ var KityMinder = km.KityMinder = kity.createClass( "KityMinder", {
getRenderContainer: function () { getRenderContainer: function () {
return this._rc; return this._rc;
},
getPaper: function () {
return this._paper;
} }
} ); } );
......
...@@ -12,6 +12,10 @@ KityMinder.registerModule( "RenderModule", function () { ...@@ -12,6 +12,10 @@ KityMinder.registerModule( "RenderModule", function () {
var drawRectNode = function ( node ) { var drawRectNode = function ( node ) {
if ( !node ) { if ( !node ) {
node = node_default; node = node_default;
} else {
for ( var key in node_default ) {
node[ key ] = node[ key ] || node_default[ key ];
}
} }
var _node = new kity.Group(); var _node = new kity.Group();
var _rect = new kity.Rect(); var _rect = new kity.Rect();
...@@ -19,9 +23,11 @@ KityMinder.registerModule( "RenderModule", function () { ...@@ -19,9 +23,11 @@ KityMinder.registerModule( "RenderModule", function () {
_rect _rect
.setRadius( node.radius ) .setRadius( node.radius )
.setSize( 100, 100 ) .setSize( 100, 100 )
.setPosition( 20, 20 ) .setPosition( 0, 0 )
.fill( node.fill ) .fill( node.fill )
.stroke( node.stroke ); .stroke( node.stroke );
_text.setX( 30 ).setY( 30 );
console.log( _text.getWidth() );
_node.addItems( [ _rect, _text ] ); _node.addItems( [ _rect, _text ] );
return _node; return _node;
}; };
...@@ -31,12 +37,11 @@ KityMinder.registerModule( "RenderModule", function () { ...@@ -31,12 +37,11 @@ KityMinder.registerModule( "RenderModule", function () {
var kR = km.getRenderContainer(); var kR = km.getRenderContainer();
var _root = km.getRoot() || new MinderNode(); var _root = km.getRoot() || new MinderNode();
var _node = drawRectNode( node ); var _node = drawRectNode( node );
console.log( _node ); console.log( _node.getShapes()[ 1 ] );
kR.addShape( _node, "background" ); kR.addShape( _node, "node" );
} }
}; };
} )() ); } )() );
// var DrawShapeCommand = kity.createClass( "DrawShapeCommand", { // var DrawShapeCommand = kity.createClass( "DrawShapeCommand", {
// base: Command, // base: Command,
// execute: function ( km, node ) { // execute: function ( km, node ) {
......
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