naver / egjs-conveyer

Conveyer adds Drag gestures to your Native Scroll.
https://naver.github.io/egjs-conveyer/
MIT License
111 stars 8 forks source link

fix: scrollIntoView ending earlier than the duration given as an option #35

Closed malangfox closed 1 year ago

malangfox commented 1 year ago

Details

https://codepen.io/malangfox/pen/MWPLWvV In the above demo, when the scrollIntoView is triggered by pressing the button, the scroll moves for 5000ms, but when item 11 is placed at the far right end and the button is pressed, the time it takes to move to the end of the scroll area is not 5000ms.

Fixing this as a bug could lead to a new issue of scrollIntoView being slow at the end of the scroll area after updating the version of Conveyer, so I would like to support the existing behavior but add an option to check the minimum/maximum scrollable distance when calculating the distance for scrollBy in scrollIntoView so that it always has the same scroll animation time.

I'm currently using the fixedDuration name as a temporary name, but I'm trying to think of another appropriate name.

malangfox commented 1 year ago

I looked at the behavior of the methods on the @egjs/flicking, and Flicking do not end the animation earlier than the duration passed as an option, so I want to unify the behavior here.

If there are any issues with the original behavior in the future, perhaps we'll add an option to support the original behavior.