Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
fix: fix sroll change detection
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpa9708 committed May 7, 2019
1 parent b727a6b commit 1ce6835
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { AnimationManager } from "./animation-manager"
import { EasingFunction, defaultEasingFunction } from "./default-settings"
import * as ScrollElement from "./element"

const LOW_VALUE = 0.01

type ElementOrQuery = Window | Element | string
type ScrollOptions = [number?, EasingFunction?]

Expand Down Expand Up @@ -43,9 +41,7 @@ class Scroll {
this.duration = options.duration || 0
this.easing = options.easing || defaultEasingFunction
this.element.addEventListener("scroll", () => {
const changed =
Math.floor(this.animationManager.position) !== Math.floor(this.scrollPosition) ||
Math.abs(this.animationManager.position - this.scrollPosition) < LOW_VALUE
const changed = Math.floor(this.animationManager.position) !== Math.floor(this.scrollPosition)
if (changed) {
this.animationManager.position = this.scrollPosition
}
Expand Down

0 comments on commit 1ce6835

Please sign in to comment.