From 4b56d34f93f8c5f637beb9b27c901aaa4509105d Mon Sep 17 00:00:00 2001 From: Freeplay Date: Mon, 22 May 2023 15:23:26 -0400 Subject: [PATCH] better way of doing that Couldn't due before becuase of how css was done --- packages/client/src/components/global/MkPageHeader.vue | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/global/MkPageHeader.vue b/packages/client/src/components/global/MkPageHeader.vue index c96b620097..4ccd9b3107 100644 --- a/packages/client/src/components/global/MkPageHeader.vue +++ b/packages/client/src/components/global/MkPageHeader.vue @@ -129,7 +129,6 @@ import { nextTick, reactive, } from "vue"; -import tinycolor from "tinycolor2"; import MkFollowButton from "@/components/MkFollowButton.vue"; import { popupMenu } from "@/os"; import { scrollToTop } from "@/scripts/scroll"; @@ -257,15 +256,11 @@ onMounted(() => { tabEl.style = `--width: ${tabSizeX}px`; } setTimeout(() => { - const parentRect = tabsEl.getBoundingClientRect(); - const rect = tabEl.getBoundingClientRect(); - const left = - rect.left - parentRect.left + tabsEl?.scrollLeft; tabHighlightEl.style.width = tabSizeX + "px"; - tabHighlightEl.style.transform = `translateX(${left}px)`; + tabHighlightEl.style.transform = `translateX(${tabEl.offsetLeft}px)`; window.requestAnimationFrame(() => { tabsEl?.scrollTo({ - left: left - 60, + left: tabEl.offsetLeft - 60, behavior: "smooth", }); });