From d023f6a5b9fad7a316533f30b22c7d381eee0500 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Mon, 10 Jun 2024 11:52:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BA=D1=83=D0=BA=D0=BE=D0=B6=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=BB=D0=BE=D0=BA=20=D1=81?= =?UTF-8?q?=D1=85=D0=B5=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/expDiagram.vue | 26 ++++++++++++++++++++++---- components/model/diagram.vue | 19 +++++++++++++------ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/components/expDiagram.vue b/components/expDiagram.vue index 0f81605..fb49694 100644 --- a/components/expDiagram.vue +++ b/components/expDiagram.vue @@ -9,15 +9,33 @@ const controlsState = reactive({ enableZoom: false, maxPolarAngle: (Math.PI / 2) - 0.2, }) - +const container = ref() +const koef = ref() +const scrollBlock = (e: Event) => { + const { top, bottom, height } = container.value.getBoundingClientRect(); + const { innerHeight } = window; + const partiallyVisible = (top > 0 && top < innerHeight) || + (bottom > 0 && bottom < innerHeight) + const visibleHeight = innerHeight - top + const h = height * 1.5 + if (partiallyVisible && visibleHeight < h) { + koef.value = visibleHeight / h + } +} +onMounted(() => { + document.addEventListener('scroll', scrollBlock) +}) +onUnmounted(() => { + document.removeEventListener('scroll', scrollBlock) +})