From 0c8b0a7513ccf457556db1486beb092265c594a3 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sat, 15 Oct 2022 14:15:46 +1100
Subject: Make BaseLine spans use TimeLine start/end offsets

Change TimelineRange to hold years not HistDates
---
 src/components/BaseLine.vue | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/components/BaseLine.vue')

diff --git a/src/components/BaseLine.vue b/src/components/BaseLine.vue
index ccadb0b..e2cf7c8 100644
--- a/src/components/BaseLine.vue
+++ b/src/components/BaseLine.vue
@@ -80,9 +80,9 @@ const labelStyles = computed((): Record<string, string> => ({
 function spanStyles(range: TimelineRange){
 	let styles: Record<string,string>;
 	let availLen = props.vert ? height.value : width.value;
-	// Determine positions in full timeline (only considers year values)
-	let startFrac = (range.start.year - MIN_DATE.year) / (MAX_DATE.year - MIN_DATE.year);
-	let lenFrac = (range.end.year - range.start.year) / (MAX_DATE.year - MIN_DATE.year);
+	// Determine positions in full timeline
+	let startFrac = (range.startYear - MIN_DATE.year) / (MAX_DATE.year - MIN_DATE.year);
+	let lenFrac = (range.endYear - range.startYear) / (MAX_DATE.year - MIN_DATE.year);
 	let startPx = Math.max(0, availLen * startFrac); // Prevent negatives due to end-padding
 	let lenPx = Math.min(availLen - startPx, availLen * lenFrac);
 	lenPx = Math.max(1, lenPx); // Prevent zero length
-- 
cgit v1.2.3

