Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skewed timeline for family events #36

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
10 changes: 10 additions & 0 deletions src/family_tree_view_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,16 @@ def draw_timeline(self, event_and_ref_list, timeline_canvas, event_labels):
except ZeroDivisionError:
y_time_rel = 0
y_time = y_time_rel * timeline_height + self.timeline_top_margin
if self.obj_type == "F":
# y_time above goes progressively skewed for a family
# because the timeline attach points were calculated on the
# entire vertical span. For a family, they should be
# calculated on the span only from time 0 to the bottom.
y_time_bottom = canvas_height - self.timeline_bottom_margin
y_time_family_factor = (y_time_bottom - (zero_event_offset + self.timeline_top_margin)) / y_time_bottom # % of the timeline
y_time_temp = y_time - (zero_event_offset + self.timeline_top_margin)
y_time_temp = y_time_temp * y_time_family_factor # apply the factor with respect to the applicable span
y_time = y_time_temp + (zero_event_offset + self.timeline_top_margin)

connect_to_previous = prev_y_time is not None and y_time - prev_y_time < 2*self.timeline_marker_radius

Expand Down