+
diff --git a/components/public/Catalog.vue b/components/public/Catalog.vue
index 3d9d47a..daf5905 100644
--- a/components/public/Catalog.vue
+++ b/components/public/Catalog.vue
@@ -21,20 +21,15 @@ function scrollToTitle(anchor: string) {
}
function updateActiveSection() {
- const scrollTop = window.pageYOffset || document.documentElement.scrollTop
const screenHeight = window.innerHeight
- let minDistanceToCenter = Number.POSITIVE_INFINITY
-
props.list.forEach((section, index) => {
const element = document.getElementById(section.title)
if (element) {
const rect = element.getBoundingClientRect()
- const distanceToCenter = Math.abs(rect.top + rect.height / 2 - (scrollTop + screenHeight / 2))
- if (distanceToCenter < minDistanceToCenter) {
+ if (rect.top < screenHeight / 2) {
activeSectionIndex = index
- minDistanceToCenter = distanceToCenter
}
}
})
@@ -54,25 +49,25 @@ onUnmounted(() => {
-
+
diff --git a/components/public/Tool.vue b/components/public/Tool.vue
index f81999d..a42dc86 100644
--- a/components/public/Tool.vue
+++ b/components/public/Tool.vue
@@ -2,6 +2,7 @@
import { onMounted, onUnmounted, ref } from 'vue'
const showButton = ref(false)
+const globalStore = useGlobalStore()
function handleScroll() {
showButton.value = window.scrollY > window.innerHeight
@@ -27,6 +28,7 @@ onUnmounted(() => {
+