From 1b14b45ac494c090037eb4c5f92321d1aebc59da Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 16 Jan 2023 00:34:36 +1100
Subject: Make title clicks reset timelines

---
 src/components/TimeLine.vue | 10 ++++++++++
 1 file changed, 10 insertions(+)

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

diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index f1188cc..56136fd 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -102,6 +102,7 @@ const props = defineProps({
 	unitCountMaps: {type: Object as PropType<Map<number, number>[]>, required: true},
 	current: {type: Boolean, required: true},
 	searchTarget: {type: Object as PropType<[null | HistEvent, boolean]>, required: true},
+	reset: {type: Boolean, required: true},
 });
 const emit = defineEmits(['close', 'state-chg', 'event-display', 'info-click']);
 
@@ -1256,6 +1257,15 @@ watch(idToEvent, () => { // Remove highlighting of search results that have beco
 	}
 });
 
+// For resets
+watch(() => props.reset, () => {
+	startDate.value = store.initialStartDate;
+	endDate.value = store.initialEndDate;
+	startOffset.value = store.defaultEndTickOffset;
+	endOffset.value = store.defaultEndTickOffset;
+	initScale();
+});
+
 // For keyboard shortcuts
 function onKeyDown(evt: KeyboardEvent){
 	if (!props.current || store.disableShortcuts){
-- 
cgit v1.2.3

