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

fix: Fix scroll speed when range is too small

This commit is contained in:
AkiraFukushima 2018-07-20 22:23:35 +09:00
parent 637e4b0bd2
commit b0f6d6f30e

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) {