Commit ae6c0298 authored by Akikonata's avatar Akikonata

dev

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