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:
commit
5006c066a0
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user