1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-31 19:17:44 +01:00

Merge pull request #445 from h3poteto/fix/autoscroll

fix: Fix scroll speed when range is too small
This commit is contained in:
AkiraFukushima 2018-07-20 22:37:27 +09:00 committed by GitHub
commit 5006c066a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,13 +8,13 @@ export default function scrollTop (element, point = 0) {
const range = start - point
// Progress of scroll: 0 ~ 100
let progress = 0
const boost = range > 200 ? range / 200 : 2.0
/**
* Scroll calling recursion.
**/
const move = function () {
progress++
const nextPos = start - range * (range / 200) * easeOut(progress / 100)
const nextPos = start - range * boost * easeOut(progress / 100)
// Stop the recursion
if (nextPos <= 0) {