From 5ca93f1e03e9321ada382d2c5ad3cb65d3c83f89 Mon Sep 17 00:00:00 2001 From: sensei <nobody@slash.goat> Date: Sat, 30 Dec 2017 10:27:18 -0700 Subject: [PATCH] add family tree to starting girls --- src/js/familyTree.tw | 5 ++++- src/utility/extendedFamilyWidgets.tw | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/js/familyTree.tw b/src/js/familyTree.tw index 542759c0925..5eeec473476 100644 --- a/src/js/familyTree.tw +++ b/src/js/familyTree.tw @@ -27,7 +27,10 @@ window.renderFamilyTree = function(slaves, filterID) { var ftreeWidth,ftreeHeight; var chartWidth, chartHeight; var margin; - var svg = d3.select('#familyTree').append('svg'); + d3.select('#ftree-canvas').remove(); + var svg = d3.select('#familyTree') + .append('svg') + .attr('id','ftree-canvas'); var chartLayer = svg.append('g').classed('chartLayer', true); var range = 100; diff --git a/src/utility/extendedFamilyWidgets.tw b/src/utility/extendedFamilyWidgets.tw index 742fa1302eb..44a6d35348f 100644 --- a/src/utility/extendedFamilyWidgets.tw +++ b/src/utility/extendedFamilyWidgets.tw @@ -877,7 +877,10 @@ <<replace '#fatherName'>><<parentName "father">><</replace>> <<replace '#sameMotherNames'>><<listOfSlavesWithSameParent 'mother'>><</replace>> <<replace '#sameFatherNames'>><<listOfSlavesWithSameParent 'father'>><</replace>> -<<run updateFamilyTree($activeSlave, $slaves, $PC)>> +/* <<run updateFamilyTree($activeSlave, $slaves, $PC)>> */ +<<set _tSlaveList = [$activeSlave]>> +<<set _tSlaveList.push.apply(_tSlaveList, $slaves)>> +<<run renderFamilyTree(_tSlaveList, $activeSlave.ID)>> <</widget>> /* First parameter is e.g. "father" or "mother" and second parameter is the ID to match */ @@ -1074,9 +1077,13 @@ <span id="familySummary"><<Family>></span> <br> </div> -<div id="graph"></div> +/*<div id="graph"></div> <<run updateFamilyTree($activeSlave, $slaves, $PC)>> -<script>updateFamilyTree()</script> +<script>updateFamilyTree()</script>*/ +<div id="familyTree"></div> +<<set _tSlaveList = [$activeSlave]>> +<<set _tSlaveList.push.apply(_tSlaveList, $slaves)>> +<<run renderFamilyTree(_tSlaveList, $activeSlave.ID)>> </div> <</widget>> -- GitLab