Merge branch 'develop' of codeberg.org:calckey/calckey into develop

This commit is contained in:
ThatOneCalculator 2023-02-12 14:51:56 -08:00
commit 1a842703b4
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
1 changed files with 8 additions and 6 deletions

View File

@ -153,12 +153,14 @@ onMounted(() => {
// offsetWidth offsetLeft getBoundingClientRect 使 // offsetWidth offsetLeft getBoundingClientRect 使
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4 // https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
function transition() { function transition() {
const parentRect = tabsEl.getBoundingClientRect(); window.requestAnimationFrame(() => {
const rect = tabEl.getBoundingClientRect(); const parentRect = tabsEl.getBoundingClientRect();
const left = (rect.left - parentRect.left + tabsEl?.scrollLeft); const rect = tabEl.getBoundingClientRect();
tabHighlightEl.style.width = rect.width + 'px'; const left = (rect.left - parentRect.left + tabsEl?.scrollLeft);
tabHighlightEl.style.left = left + 'px'; tabHighlightEl.style.width = rect.width + 'px';
tabsEl?.scrollTo({left: left - 80, behavior: "smooth"}); tabHighlightEl.style.left = left + 'px';
tabsEl?.scrollTo({left: left - 80, behavior: "smooth"});
})
tabEl.removeEventListener("transitionend", transition); tabEl.removeEventListener("transitionend", transition);
} }
tabEl.addEventListener("transitionend", transition); tabEl.addEventListener("transitionend", transition);