Commit f4fde756 authored by Akikonata's avatar Akikonata

changed x and y

parent 77cb3397
......@@ -16,8 +16,6 @@
var _root = minder.getRoot();
_root.setData("data",{
x:minderWidth/2,
y:minderHeight/2,
style:{
radius:10,
fill:"orange",
......@@ -25,10 +23,12 @@
color:"black",
padding:[10,10,10,10],
fontSize:20,
align:"center"
},
text:"I am the root",
});
_root.setData("x",minderWidth/2);
_root.setData("y",minderHeight/2);
_root.setData("align","center");
minder.select(_root);
minder.execCommand("rendernode",_root);
......
......@@ -4,10 +4,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command,
execute: function ( km, parent ) {
var _node = new MinderNode();
_node.setData( "x", parent.getData( "x" ) + 200 );
_node.setData( "y", Math.random() * 300 + 100 );
_node.setData( "align", "left" );
var _nodeD = {
text: "New Node",
x: parent.getData( "data" ).x + 200,
y: Math.random() * 300 + 100,
align: "left"
};
switch ( parent.branchside ) {
......@@ -16,17 +17,20 @@ KityMinder.registerModule( "LayoutModule", function () {
case "right":
break;
default:
( function () {
} )();
break;
};
}
_node.setData( "data", _nodeD );
parent.insertChild( _node );
km.execCommand( 'rendernode', _node );
return _node;
}
}
};
} )() );
var CreateSiblingNodeCommand = kity.createClass( "CreateSiblingNodeCommand", ( function () {
var CreateSiblingNodeCommand = kity.createClass( "CreateSiblingNodeCommand", ( function () {
return {
base: Command,
execute: function ( km, sibling, node ) {
......@@ -35,6 +39,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
}
} )() );
var RemoveNodeCommand = kity.createClass( "RemoveNodeCommand", ( function () {
return {
......
......@@ -15,13 +15,11 @@ KityMinder.registerModule( "RenderModule", function () {
unhighlight: function () {
this.rect.stroke( this.NormalInfo );
}
}
};
} )() );
var renderNode = function ( km, node ) {
var node_default = {
x: 0,
y: 0,
text: "Root",
style: {
radius: 10,
......@@ -29,8 +27,7 @@ KityMinder.registerModule( "RenderModule", function () {
stroke: "orange",
color: "black",
padding: [ 5, 5, 5, 5 ],
fontSize: 12,
align: "left"
fontSize: 12
}
};
var kR = node.getRenderContainer();
......@@ -54,16 +51,15 @@ KityMinder.registerModule( "RenderModule", function () {
nodeShape.NormalInfo = new kity.Pen( _style.stroke, _style.strokeWidth );
nodeShape.rect.setWidth( _rectWidth ).setHeight( _rectHeight ).stroke( nodeShape.NormalInfo ).fill( _style.fill ).setRadius( _style.radius );
switch ( nodeD.align ) {
switch ( node.align ) {
case "center":
nodeShape.shape.translate( nodeD.x - _rectWidth / 2, nodeD.y - _rectHeight / 2 );
nodeShape.shape.translate( node.getData( "x" ) - _rectWidth / 2, node.getData( "y" ) - _rectHeight / 2 );
break;
case "right":
nodeShape.shape.translate( nodeD.x - _rectWidth, nodeD.y - _rectHeight / 2 );
nodeShape.shape.translate( node.getData( "x" ) - _rectWidth, node.getData( "y" ) - _rectHeight / 2 );
break;
default:
nodeShape.shape.translate( nodeD.x, nodeD.y - _rectHeight / 2 );
nodeShape.shape.translate( node.getData( "x" ), node.getData( "y" ) - _rectHeight / 2 );
break;
}
......
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