fix: tweak carousel to show button change sooner (#940)
This commit is contained in:
parent
7583d488a0
commit
10b14abcdb
|
@ -183,7 +183,7 @@
|
||||||
oncreate () {
|
oncreate () {
|
||||||
onCreateDialog.call(this)
|
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()
|
let { scrolledItem } = this.get()
|
||||||
if (scrolledItem) {
|
if (scrolledItem) {
|
||||||
|
@ -198,7 +198,6 @@
|
||||||
},
|
},
|
||||||
ondestroy () {
|
ondestroy () {
|
||||||
this.teardownScroll()
|
this.teardownScroll()
|
||||||
|
|
||||||
popShortcutScope('mediaDialog')
|
popShortcutScope('mediaDialog')
|
||||||
},
|
},
|
||||||
store: () => store,
|
store: () => store,
|
||||||
|
@ -262,11 +261,12 @@
|
||||||
this.scrollToItem(scrolledItem - 1, true)
|
this.scrollToItem(scrolledItem - 1, true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scrollToItem (i, smooth) {
|
scrollToItem (scrolledItem, smooth) {
|
||||||
|
this.set({ scrolledItem: scrolledItem })
|
||||||
let { length } = this.get()
|
let { length } = this.get()
|
||||||
let { scroller } = this.refs
|
let { scroller } = this.refs
|
||||||
let { scrollWidth } = scroller
|
let { scrollWidth } = scroller
|
||||||
let scrollLeft = Math.floor(scrollWidth * (i / length))
|
let scrollLeft = Math.floor(scrollWidth * (scrolledItem / length))
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
smoothScroll(scroller, scrollLeft, true)
|
smoothScroll(scroller, scrollLeft, true)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue