Commit df4b9823 authored by techird's avatar techird

stash

parent d652a8fb
......@@ -24,6 +24,15 @@ kity.extendClass(MinderNode, {
return layout;
},
applyLayoutResult: function (parentX, parentY) {
var myX = parentX + this.layoutX,
myY = parentY + this.layoutY;
this.getRenderContainer().fxTranslate(myX, myY);
this.getChildren().forEach(function(node) {
node.applyLayoutResult(myX, myY);
});
},
layout: function(name) {
if (name) {
this.setData('layout', name);
......@@ -31,6 +40,7 @@ kity.extendClass(MinderNode, {
var LayoutClass = KityMinder._layout[this.getLayout()];
var layout = new LayoutClass();
layout.doLayout(this);
this.applyLayoutResult(0, 0);
return this;
},
......
......@@ -2,10 +2,19 @@
KityMinder.registerLayout('default', kity.createClass({
base: Layout,
doLayout: function(node) {
node.getChildren().forEach(function(childNode) {
childNode.layout();
});
var y = 0;
node.getChildren().forEach(function(childNode) {
childNode.layoutX = node.getContentBox().right - childNode.getContentBox().x + node.getStyle('margin-right');
childNode.layoutY = y;
y += 50;
console.log(childNode.layoutX, childNode.layoutY);
});
node.layoutX = 0;
node.layoutY = 0;
}
}));
\ No newline at end of file
......@@ -17,17 +17,20 @@ KityMinder.registerModule('OutlineModule', function() {
paddingRight = node.getStyle('padding-right'),
paddingTop = node.getStyle('padding-top'),
paddingBottom = node.getStyle('padding-bottom');
var outlineBox = {
x: contentBox.x - paddingLeft,
y: contentBox.y - paddingTop,
width: contentBox.width + paddingLeft + paddingRight,
height: contentBox.height + paddingTop + paddingBottom
};
this.outline
.setPosition(
contentBox.x - paddingLeft,
contentBox.y - paddingTop)
.setSize(
contentBox.width + paddingLeft + paddingRight,
contentBox.height + paddingTop + paddingBottom)
.setPosition(outlineBox.x, outlineBox.y)
.setSize(outlineBox.width, outlineBox.height)
.setRadius(node.getStyle('radius'))
.fill(node.isSelected() ?
node.getStyle('selected-background') :
node.getStyle('background'));
return outlineBox;
}
})
}
......
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