From 90df26d97d829d4b78fb1934ff8d362601b4bd82 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 18 Jan 2023 20:35:47 +1100
Subject: Adjust heuristic for limit on events requested

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

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 4c6590a..4149a66 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -193,8 +193,10 @@ function reduceEvents(){
 }
 // For getting events from server
 const eventReqLimit = computed(() => {
-	const eventSz = store.eventImgSz * (store.eventImgSz + store.eventLabelHeight);
-	return Math.max(20, Math.ceil(contentWidth.value * contentHeight.value / eventSz));
+	return Math.ceil(Math.max(contentWidth.value, contentHeight.value) / store.eventImgSz * 32);
+		// As a rough heuristic, the number of events that could fit along the major axis,
+		// multiplied by a rough number of time points per event-occupied region,
+		// multiplied by the max number of events per time point (four).
 });
 const MAX_EVENTS_PER_UNIT = 4; // Should equal MAX_DISPLAYED_PER_UNIT in backend gen_disp_data.py
 let queriedRanges: DateRangeTree[] = SCALES.map(() => new DateRangeTree());
-- 
cgit v1.2.3

