summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-09-29 16:34:31 +0300
committerAlon Levy <alon@pobox.com>2014-09-29 16:34:31 +0300
commit6e19d60fdecaee0138299de83c3e98644d003877 (patch)
tree97c9e0f1fe8b11f26ed63b933f51db4527ce56fa /scripts
parent8b202359066f61ddbcd322123f197fbc2fc4dda2 (diff)
rhizicore: fix popping node on top left when creating a new node
The fix is ugly. Basically we are relying on the force layout [1] for the locations of the nodes. I've hidden the node until the first tick. Since we do a tick calculation (tick is a function in rhizicore) when adding a node there is no associated delay. [1] https://github.com/mbostock/d3/wiki/Force-Layout
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rhizicore.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js
index de185fc9..70adfc3b 100644
--- a/scripts/rhizicore.js
+++ b/scripts/rhizicore.js
@@ -578,6 +578,7 @@ function myGraph(el) {
var nodeEnter = node.enter()
.append("g").attr('class', 'node')
+ .attr('visibility', 'hidden') // made visible on first tick
.on("click", function(d, i) {
if (d3.event.defaultPrevented) {
// drag happened, ignore click https://github.com/mbostock/d3/wiki/Drag-Behavior#on
@@ -827,6 +828,9 @@ function tick(e) {
}
});
+ // After initial placement we can make the nodes visible.
+ //links.attr('visibility', 'visible');
+ node.attr('visibility', 'visible');
}