Fixed node size change bug

This commit is contained in:
Gonzalo Bellver 2012-01-18 20:02:15 -03:00
parent 830f65caa9
commit 62b3bf8bc0
2 changed files with 6 additions and 2 deletions

View File

@ -94,10 +94,13 @@ mindplot.layout.Node = new Class({
},
hasPositionChanged: function() {
return this._isPropertyChanged('position');
},
hasSizeChanged: function() {
return this._isPropertyChanged('size');
},
getPosition: function() {
return this._getProperty('position');
},

View File

@ -89,6 +89,7 @@ mindplot.layout.OriginalLayout = new Class({
var children = this._treeSet.getChildren(node);
var parent = this._treeSet.getParent(node);
var childrenOrderMoved = children.some(function(child) { return child.hasOrderChanged(); });
var childrenSizeChanged = children.some(function(child) { return child.hasSizeChanged(); });
// If ether any of the nodes has been changed of position or the height of the children is not
// the same, children nodes must be repositioned ....
@ -98,7 +99,7 @@ mindplot.layout.OriginalLayout = new Class({
var heightChanged = node._branchHeight != newBranchHeight;
node._heightChanged = heightChanged || parentHeightChanged;
if (childrenOrderMoved || heightChanged || parentHeightChanged) {
if (childrenOrderMoved || childrenSizeChanged || heightChanged || parentHeightChanged) {
var sorter = node.getSorter();
var offsetById = sorter.computeOffsets(this._treeSet, node);
var parentPosition = node.getPosition();