From b69df7f8e1547786f32539f3562f05e2da0950c3 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 20 Oct 2022 11:12:32 +1100
Subject: Move various constants to global store

---
 src/App.vue | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index e836fbf..4eed256 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -63,12 +63,10 @@ onMounted(updateAreaDims)
 
 // Timeline data
 const timelines: Ref<TimelineState[]> = ref([]);
-const INITIAL_START_DATE = new HistDate(1900, 1, 1);
-const INITIAL_END_DATE = new HistDate(2000, 1, 1);
 let nextTimelineId = 1;
 function addTimeline(){
 	if (timelines.value.length == 0){
-		timelines.value.push(new TimelineState(nextTimelineId, INITIAL_START_DATE, INITIAL_END_DATE));
+		timelines.value.push(new TimelineState(nextTimelineId, store.initialStartDate, store.initialEndDate));
 	} else {
 		let last = timelines.value[timelines.value.length - 1];
 		timelines.value.push(new TimelineState(
@@ -84,7 +82,7 @@ function onTimelineChg(state: TimelineState, idx: number){
 }
 
 // For timeline addition/removal
-const MIN_TIMELINE_BREADTH = 80 + 10 * 2 + 120; // TODO: Link with constants in components/TimeLine.vue
+const MIN_TIMELINE_BREADTH = store.mainlineBreadth + store.spacing * 2 + store.eventImgSz + store.eventLabelHeight;
 function onTimelineAdd(){
 	if (vert.value && contentWidth.value / (timelines.value.length + 1) < MIN_TIMELINE_BREADTH ||
 		!vert.value && contentHeight.value / (timelines.value.length + 1) < MIN_TIMELINE_BREADTH){
-- 
cgit v1.2.3

