Simon Hunt

GUI -- Fixed host node exit animation.

Change-Id: If9ad86451f5f7905fa01101d060d0490e206a4bc
...@@ -625,12 +625,12 @@ ...@@ -625,12 +625,12 @@
625 }) 625 })
626 .style('opacity', 0.4) 626 .style('opacity', 0.4)
627 .transition() 627 .transition()
628 - .duration(2000) 628 + .duration(1500)
629 .attr({ 629 .attr({
630 'stroke-dasharray': '3, 12' 630 'stroke-dasharray': '3, 12'
631 }) 631 })
632 .transition() 632 .transition()
633 - .duration(1000) 633 + .duration(500)
634 .style('opacity', 0.0) 634 .style('opacity', 0.0)
635 .remove(); 635 .remove();
636 } 636 }
...@@ -884,18 +884,37 @@ ...@@ -884,18 +884,37 @@
884 //node .foo() .bar() ... 884 //node .foo() .bar() ...
885 885
886 // operate on exiting nodes: 886 // operate on exiting nodes:
887 - // TODO: figure out how to remove the node 'g' AND its children 887 + // Note that the node is removed after 2 seconds.
888 - node.exit() 888 + // Sub element animations should be shorter than 2 seconds.
889 - .transition() 889 + var exiting = node.exit()
890 - .style('opacity', 0.4)
891 - .attr('fill', '#888')
892 .transition() 890 .transition()
893 .duration(2000) 891 .duration(2000)
894 - .attr({ 892 + .style('opacity', 0)
895 - opacity: 0,
896 - r: 0
897 - })
898 .remove(); 893 .remove();
894 +
895 + // host node exits....
896 + exiting.filter('.host').each(function (d) {
897 + var node = d3.select(this);
898 +
899 + node.select('text')
900 + .style('opacity', 0.5)
901 + .transition()
902 + .duration(1000)
903 + .style('opacity', 0);
904 + // note, leave <g>.remove to remove this element
905 +
906 + node.select('circle')
907 + .style('stroke-fill', '#555')
908 + .style('fill', '#888')
909 + .style('opacity', 0.5)
910 + .transition()
911 + .duration(1500)
912 + .attr('r', 0);
913 + // note, leave <g>.remove to remove this element
914 +
915 + });
916 +
917 + // TODO: device node exits
899 } 918 }
900 919
901 function find(id, array) { 920 function find(id, array) {
......