From e045f6461b5ceabb285b00fb9db0050a3d1f9d8d Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sun, 15 Jan 2023 01:29:40 +1100
Subject: Fix event lines not updating on certain resizes

---
 src/components/TimeLine.vue | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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

diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index bab6e5e..c72fbff 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -636,7 +636,7 @@ function getEventLayout(): Map<number, [number, number, number, number]> {
 	}
 	return map;
 }
-watch(idToEvent, () => { // Updates idToPos and eventLines
+function updateLayout(){ // Updates idToPos and eventLines
 	let map = getEventLayout();
 	// Check for events that cross mainline
 	idsToSkipTransition.value.clear();
@@ -705,7 +705,10 @@ watch(idToEvent, () => { // Updates idToPos and eventLines
 	eventLines.value = newEventLines;
 	// Notify parent
 	emit('event-display', ID, [...map.keys()], firstDate.value, lastDate.value, minorScaleIdx.value);
-});
+}
+watch(idToEvent, updateLayout);
+watch(width, updateLayout);
+watch(height, updateLayout);
 
 // For event-count indicators
 const tickToCount = computed((): Map<number, number> => {
-- 
cgit v1.2.3

