Narrative web: Ancestor's tree Fix display looks weird (#929)

* Narrative web: Ancestor's tree display looks weird

Solves the following:
- Person boxes overlap
- Some person boxes partially visible or hidden

Fixes #11382

* Narrative web: some cleanup in ancestortree.css

* Narrative web : ancestor tree and long names.

* Adapt ancestor tree css file for all themes
This commit is contained in:
Serge Noiraud
2019-10-17 02:17:31 +02:00
committed by Sam Manzi
parent 75b0b66269
commit ee1d9be898
3 changed files with 106 additions and 57 deletions

View File

@@ -132,7 +132,6 @@ class DrawTree(object):
"""
return self.tree.handle
def buchheim(tree, node_width, h_separation, node_height, v_separation):
"""
Calculate the position of elements of the graph given a minimum
@@ -142,9 +141,30 @@ def buchheim(tree, node_width, h_separation, node_height, v_separation):
min_x = second_walk(draw_tree, 0, node_width+h_separation, 0)
if min_x < 0:
third_walk(draw_tree, 0 - min_x)
top = get_min_coord_y(draw_tree)
height = get_max_coord_y(draw_tree)
return draw_tree
return (draw_tree, top, height)
def get_min_coord_y(tree, min_value=100.0):
""" Get the minimum coord_y """
if tree.coord_y < min_value:
min_value = tree.coord_y
for child in tree.children:
min_v = get_min_coord_y(child, min_value)
if min_value > min_v:
min_value = min_v
return min_value
def get_max_coord_y(tree, max_value=0.0):
""" Get the maximum coord_y """
if tree.coord_y > max_value:
max_value = tree.coord_y
for child in tree.children:
max_v = get_max_coord_y(child, max_value)
if max_value < max_v:
max_value = max_v
return max_value
def third_walk(tree, adjust):
"""
@@ -156,7 +176,6 @@ def third_walk(tree, adjust):
for child in tree.children:
third_walk(child, adjust)
def firstwalk(tree, node_height, v_separation):
"""
Determine horizontal positions.
@@ -189,7 +208,6 @@ def firstwalk(tree, node_height, v_separation):
tree.height = max(tree.height, tree.coord_y)
return tree
def apportion(tree, default_ancestor, v_separation):
"""
Figure out relative positions of node in a tree.
@@ -263,7 +281,6 @@ def execute_shifts(tree):
child.height = max(child.height, child.coord_y)
tree.height = max(tree.height, child.height)
def ancestor(vil, tree, default_ancestor):
"""
The relevant text is at the bottom of page 7 of