From 10b14abcdb381a1eeb4902d201240302b73cd041 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 5 Feb 2019 09:54:38 -0800 Subject: [PATCH] fix: tweak carousel to show button change sooner (#940) --- src/routes/_components/dialog/components/MediaDialog.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/_components/dialog/components/MediaDialog.html b/src/routes/_components/dialog/components/MediaDialog.html index ea3f27d0..bc8d0469 100644 --- a/src/routes/_components/dialog/components/MediaDialog.html +++ b/src/routes/_components/dialog/components/MediaDialog.html @@ -183,7 +183,7 @@ oncreate () { onCreateDialog.call(this) - this.onScroll = debounce(this.onScroll.bind(this), 100, { leading: false, trailing: true }) + this.onScroll = debounce(this.onScroll.bind(this), 50, { leading: false, trailing: true }) let { scrolledItem } = this.get() if (scrolledItem) { @@ -198,7 +198,6 @@ }, ondestroy () { this.teardownScroll() - popShortcutScope('mediaDialog') }, store: () => store, @@ -262,11 +261,12 @@ this.scrollToItem(scrolledItem - 1, true) } }, - scrollToItem (i, smooth) { + scrollToItem (scrolledItem, smooth) { + this.set({ scrolledItem: scrolledItem }) let { length } = this.get() let { scroller } = this.refs let { scrollWidth } = scroller - let scrollLeft = Math.floor(scrollWidth * (i / length)) + let scrollLeft = Math.floor(scrollWidth * (scrolledItem / length)) if (smooth) { smoothScroll(scroller, scrollLeft, true) } else {