ilyashubin / scrollbooster

Enjoyable content drag-to-scroll library
https://ilyashubin.github.io/scrollbooster
MIT License
993 stars 80 forks source link

Jumpy behavior when dragging with mouse after scrolling with touchpad #8

Closed seahorsepip closed 4 years ago

seahorsepip commented 5 years ago

I've a horizontal scroll view that can be scrolled my touch, touchpad or by dragging with scrollbooster. When the scroll view is scrolled using the touchpad and afterwards dragged by scrollbooster, I get jumpy behavior :/

Currently I've worked around it by updating the scrollbooster offset in the shouldScroll method:

//Jumpy behavior workaround
shouldScroll: () => {
        sb.setPosition({x: scrollView.scrollLeft});
        return true
}
byman64 commented 5 years ago

I have the same isse, where I should add that? scrollbooster.js? Can you give me more details...I tried at line 154 but I get an error:

Uncaught ReferenceError: scrollView is not defined
    at Object.shouldScroll (index.js:58)
    at HTMLDivElement.events.pointerdown (index.js:367)

thx

WagnerExpansiva commented 5 years ago

@byman64

mybe

sb.setPosition({x: viewport.scrollLeft});

ilyashubin commented 4 years ago

Not sure I understand correctly. Is this issue still relevant on version 2.0? Some online sandbox with example would be very useful

ilyashubin commented 4 years ago

I think this may be due to an open devtools I'm closing this for now, please let me know if this issue still remains