|
@@ -22,14 +22,13 @@ export default ({images = [], className, onChange, onClick, ...props}) => {
|
|
|
}, [divRef, imgs])
|
|
|
|
|
|
const scrollToCurrent = () => {
|
|
|
- if (autoscroll.current || !containerRef.current) return;
|
|
|
|
|
|
const el = containerRef.current
|
|
|
+ autoscroll.current = true
|
|
|
|
|
|
const step = () => {
|
|
|
- if (!el) return;
|
|
|
+ if (!autoscroll.current || !el) return;
|
|
|
|
|
|
- autoscroll.current = true
|
|
|
const {scrollLeft} = el
|
|
|
const diff = (currentScrollPosition.current - scrollLeft) /5
|
|
|
if (Math.abs(diff) > 1){
|
|
@@ -90,8 +89,8 @@ export default ({images = [], className, onChange, onClick, ...props}) => {
|
|
|
}
|
|
|
|
|
|
const onScroll = e => {
|
|
|
- autoscroll.current = false
|
|
|
- //if (autoscroll.current) return;
|
|
|
+ //autoscroll.current = false
|
|
|
+ if (autoscroll.current) return;
|
|
|
|
|
|
if (timeout.current) clearInterval(timeout.current)
|
|
|
|