From 05d9c6fb4c5688865db9afd75d4f155dd2547a23 Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Wed, 17 Apr 2024 16:22:48 +0200
Subject: [PATCH] Adapt intersect handler to header

by introducing rootMargin.

app-bar & crud-iterator header where not included in top element
calculation.
165 px is again a magic number & should be replaced by direct
references.
But it is still not clear how to get the app-bar height.
---
 .../alsijil/frontend/components/coursebook/Coursebook.vue     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
index 07c0e1faf..f0e55fc35 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
@@ -22,6 +22,7 @@
         v-intersect="{
             handler: intersectHandler(date, idx, lastIdx),
             options: {
+              rootMargin: '-165px 0px 0px 0px',
               threshold: [0, 1],
             },
           }"
@@ -240,7 +241,8 @@ export default {
         const entry = entries[0];
         if (entry.isIntersecting) {
 
-          if (entry.boundingClientRect.top <= 0) {
+          // TODO: Make 165 a var?
+          if (entry.boundingClientRect.top <= 165) {
             console.log('@', date.toISODate());
             this.setDate(date.toISODate());
           }
-- 
GitLab