From 5893b4c1177a9c6f3c5a13e0985d2b7861e08c29 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Sat, 10 Jun 2023 16:49:07 -0400 Subject: [PATCH] simpler way lol --- packages/client/src/ui/universal.vue | 14 +++++++++++--- packages/client/src/ui/universal.widgets.vue | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/client/src/ui/universal.vue b/packages/client/src/ui/universal.vue index 3a7f76708f..4c38648ead 100644 --- a/packages/client/src/ui/universal.vue +++ b/packages/client/src/ui/universal.vue @@ -381,9 +381,12 @@ const onContextmenu = (ev: MouseEvent) => { }; const attachSticky = (el: any) => { - const sticky = new StickySidebar(widgetsEl); - addEventListener("scroll", () => { - sticky.calc(window.scrollY) + let lastScrollTop = 0; + addEventListener("scroll", (ev) => { + requestAnimationFrame(() => { + widgetsEl.scrollTop += window.scrollY - lastScrollTop; + lastScrollTop = window.scrollY <= 0 ? 0 : window.scrollY; + }) }, { passive: true }); }; @@ -557,8 +560,13 @@ console.log(mainRouter.currentRoute.value.name); } > .widgets-container { + position: sticky; + top: 0; + max-height: 100vh; + overflow-y: auto; padding: 0 var(--margin); width: 300px; + min-width: max-content; box-sizing: content-box; @media (max-width: $widgets-hide-threshold) { diff --git a/packages/client/src/ui/universal.widgets.vue b/packages/client/src/ui/universal.widgets.vue index 6e5f8df232..d931e1bf3f 100644 --- a/packages/client/src/ui/universal.widgets.vue +++ b/packages/client/src/ui/universal.widgets.vue @@ -84,7 +84,6 @@ function updateWidgets(widgets) {