mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-29 09:04:54 +01:00
Solved issue when overlapping a free node to another branch
This commit is contained in:
parent
9f4c928d13
commit
dc4f47ab7a
@ -31,6 +31,7 @@ mindplot.layout.AbstractBasicSorter = new Class({
|
|||||||
|
|
||||||
_computeChildrenHeight : function(treeSet, node, heightCache) {
|
_computeChildrenHeight : function(treeSet, node, heightCache) {
|
||||||
var height = node.getSize().height + (this._getVerticalPadding() * 2); // 2* Top and down padding;
|
var height = node.getSize().height + (this._getVerticalPadding() * 2); // 2* Top and down padding;
|
||||||
|
height += Math.abs(node.getFreeDisplacement().y);
|
||||||
|
|
||||||
var result;
|
var result;
|
||||||
var children = treeSet.getChildren(node);
|
var children = treeSet.getChildren(node);
|
||||||
|
@ -178,6 +178,10 @@
|
|||||||
|
|
||||||
<h3>testBalancedFreePredict:</h3>
|
<h3>testBalancedFreePredict:</h3>
|
||||||
<div id="testBalancedFreePredict1" class="col"></div>
|
<div id="testBalancedFreePredict1" class="col"></div>
|
||||||
|
|
||||||
|
<h3>testFreeReorder:</h3>
|
||||||
|
<div id="testFreeReorder1" class="col"></div>
|
||||||
|
<div id="testFreeReorder2" class="col"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -27,6 +27,7 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
this.testSiblingOverlapping();
|
this.testSiblingOverlapping();
|
||||||
this.testRootNodeChildrenPositioning();
|
this.testRootNodeChildrenPositioning();
|
||||||
this.testBalancedFreePredict();
|
this.testBalancedFreePredict();
|
||||||
|
this.testFreeReorder();
|
||||||
},
|
},
|
||||||
|
|
||||||
testFreePosition: function() {
|
testFreePosition: function() {
|
||||||
@ -362,6 +363,44 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
console.log("OK!\n\n");
|
console.log("OK!\n\n");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testFreeReorder: function() {
|
||||||
|
console.log("testFreeReorder:");
|
||||||
|
var position = {x:0,y:0};
|
||||||
|
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||||
|
|
||||||
|
// Prepare a sample graph ...
|
||||||
|
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,1,0);
|
||||||
|
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,4,0);
|
||||||
|
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,5,1);
|
||||||
|
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,6,2);
|
||||||
|
|
||||||
|
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,2,2);
|
||||||
|
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,7,0);
|
||||||
|
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,8,1);
|
||||||
|
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,9,2);
|
||||||
|
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,10,3);
|
||||||
|
|
||||||
|
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,3,4);
|
||||||
|
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,11,0);
|
||||||
|
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,12,1);
|
||||||
|
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,13,2);
|
||||||
|
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,14,3);
|
||||||
|
manager.addNode(15, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,15,4);
|
||||||
|
manager.addNode(16, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,16,5);
|
||||||
|
|
||||||
|
manager.layout();
|
||||||
|
// var graph1 = manager.plot("testFreeReorder1", {width:800, height:800});
|
||||||
|
|
||||||
|
manager.moveNode(14, {x:270, y:-160});
|
||||||
|
manager.layout();
|
||||||
|
var graph1 = manager.plot("testFreeReorder2", {width:800, height:1200});
|
||||||
|
|
||||||
|
$assert(manager.find(14).getPosition().y > manager.find(10).getPosition().y, "Node 14 should be below branch 2");
|
||||||
|
|
||||||
|
|
||||||
|
console.log("OK!\n\n");
|
||||||
|
},
|
||||||
|
|
||||||
_assertFreePosition: function(manager, id, position) {
|
_assertFreePosition: function(manager, id, position) {
|
||||||
if (id != null && position.x != null && position.y != null) {
|
if (id != null && position.x != null && position.y != null) {
|
||||||
var node = manager.find(id);
|
var node = manager.find(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user