Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.hooks.trigger(this.hooks.eventTypes.touchEnd, pos)
if (this.hooks.trigger(this.hooks.eventTypes.end, pos)) {
return true
}
// check if it is a click operation
if (!actions.moved && this.checkClick(e)) {
this.animater.setForceStopped(false)
this.hooks.trigger(this.hooks.eventTypes.scrollCancel)
return true
}
this.animater.setForceStopped(false)
// reset if we are outside of the boundaries
if (this.resetPosition(this.options.bounceTime, ease.bounce)) {
return true
}
}
)
resetPosition(time = 0, easing?: EaseItem) {
easing = !easing ? ease.bounce : easing
const {
position: x,
inBoundary: xInBoundary
} = this.scrollBehaviorX.checkInBoundary()
const {
position: y,
inBoundary: yInBoundary
} = this.scrollBehaviorY.checkInBoundary()
if (xInBoundary && yInBoundary) {
return false
}
// out of boundary
this.scrollTo(x, y, time, easing)
scrollTo(
x: number,
y: number,
time = 0,
easing?: EaseItem,
extraTransform = {
start: {},
end: {}
},
isSilent?: boolean
) {
easing = !easing ? ease.bounce : easing
const easingFn = this.options.useTransition ? easing.style : easing.fn
const currentPos = this.getCurrentPos()
const startPoint = {
x: currentPos.x,
y: currentPos.y,
...extraTransform.start
}
const endPoint = {
x,
y,
...extraTransform.end
}
this.hooks.trigger(this.hooks.eventTypes.scrollTo, endPoint)
if (!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)) {
private transitionEnd(e: TouchEvent) {
if (e.target !== this.content || !this.animater.pending) {
return
}
const animater = this.animater as Transition
animater.transitionTime()
if (!this.resetPosition(this.options.bounceTime, ease.bounce)) {
this.animater.setPending(false)
if (this.options.probeType !== Probe.Realtime) {
this.hooks.trigger(
this.hooks.eventTypes.scrollEnd,
this.getCurrentPos()
)
}
}
}
finish() {
this.pulling = false
this.scroll.minScrollY = this.originalMinScrollY
this.scroll.resetPosition(this.scroll.options.bounceTime, ease.bounce)
}