From 6b8d7fcda5dc884086bfb5df914e3f13dca5ac3c Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 28 Dec 2022 13:52:12 +1100
Subject: Don't re-query server for same range and scale

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

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

diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index c909c67..b1607ef 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -160,7 +160,8 @@ const hasMinorScale = computed(() => { // If true, display subset of ticks of ne
 	}
 	return (availLen.value / numUnits) >= 2 * store.minTickSep;
 });
-const minorScale = computed(() => hasMinorScale.value ? SCALES[scaleIdx.value + 1] : scale.value);
+const minorScaleIdx = computed(() => scaleIdx.value + (hasMinorScale.value ? 1 : 0));
+const minorScale = computed(() => SCALES[minorScaleIdx.value]);
 if (props.initialState.startOffset != null){
 	startOffset.value = props.initialState.startOffset as number;
 }
@@ -561,15 +562,8 @@ const idToPos = computed(() => {
 			}
 		}
 	}
-	// If more events could be displayed, notify parent
-	let colFillThreshold = (availLen.value - store.spacing) / (eventMajorSz.value + store.spacing) * 2/3;
-	let full = cols.every(col => col.length >= colFillThreshold);
-	if (!full){
-		emit('event-req', firstDate.value, lastDate.value);
-	} else { // Send displayed event IDs to parent
-		emit('event-display', [...map.keys()], ID);
-	}
-	//
+	// Notify parent
+	emit('event-display', ID, [...map.keys()], firstDate.value, lastDate.value, minorScaleIdx.value);
 	return map;
 });
 
-- 
cgit v1.2.3

