Merge branch 'master' of ssh://wisemapping.com/var/git-repos/wise-source
This commit is contained in:
@@ -102,11 +102,24 @@ mindplot.layout.LayoutManager = new Class({
|
||||
return this;
|
||||
},
|
||||
|
||||
predict: function(parentId, position) {
|
||||
predict: function(parentId, position, free) {
|
||||
$assert($defined(parentId), "parentId can not be null");
|
||||
|
||||
var parent = this._treeSet.find(parentId);
|
||||
var sorter = parent.getSorter();
|
||||
|
||||
if (free) {
|
||||
$assert($defined(position), "position cannot be null for predict in free positioning");
|
||||
var rootNode = this._treeSet.getRootNode(parent);
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
var xPos = direction > 0 ?
|
||||
(position.x >= parent.getPosition().x ? position.x : parent.getPosition().x) :
|
||||
(position.x <= parent.getPosition().x ? position.x : parent.getPosition().x);
|
||||
|
||||
return {order:0, position:{x: xPos, y:position.y}};
|
||||
}
|
||||
|
||||
|
||||
var result = sorter.predict(parent, this._treeSet, position);
|
||||
return {order:result[0],position:result[1]};
|
||||
},
|
||||
|
@@ -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');
|
||||
},
|
||||
|
@@ -53,6 +53,10 @@ mindplot.layout.OriginalLayout = new Class({
|
||||
var parent = this._treeSet.getParent(node);
|
||||
$assert(parent, "Node already disconnected");
|
||||
|
||||
// Make it fixed
|
||||
node.setFree(false);
|
||||
node.setFreeDisplacement({x:0, y:0});
|
||||
|
||||
// Remove from children list.
|
||||
var sorter = parent.getSorter();
|
||||
sorter.detach(this._treeSet, node);
|
||||
@@ -85,9 +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 childrenFreeChanged = children.some(function(child) { return child.hasFreeChanged(); });
|
||||
var freeChanged = node.hasFreeChanged() || childrenFreeChanged;
|
||||
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 ....
|
||||
@@ -97,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();
|
||||
|
Reference in New Issue
Block a user