This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复滚动事件判断

old
宇天 2021-05-07 23:18:13 +08:00
parent fa25b5d4d8
commit 666bed7aea
1 changed files with 10 additions and 15 deletions

View File

@ -275,7 +275,7 @@ export default class Scroll {
}) })
// 鼠标滚动事件 // 鼠标滚动事件
this._scrollFn = $.bind(this.__BOX__, 'scroll', ev => { this._scrollFn = $.catch(this.__BOX__, 'scroll', ev => {
// 拖拽时忽略滚动事件 // 拖拽时忽略滚动事件
if (this._active) { if (this._active) {
return return
@ -298,7 +298,6 @@ export default class Scroll {
if (xBar === 0 && yBar === 0) { if (xBar === 0 && yBar === 0) {
return return
} }
console.log(currTop, currLeft)
// //
if (axis === 'y' || axis === 'xy') { if (axis === 'y' || axis === 'xy') {
@ -309,15 +308,13 @@ export default class Scroll {
fixedY = fixedY >> 0 fixedY = fixedY >> 0
if (fixedY === thumbY) { if (fixedY !== thumbY) {
return this.state.thumbY = fixedY
} this.__Y__.style.transform = `translateY(${fixedY}px)`
this.state.thumbY = fixedY if (Math.abs(fixedY - thumbY) > this.props.distance) {
this.__Y__.style.transform = `translateY(${fixedY}px)` this._fireReachEnd(fixedY > thumbY ? 'reach-bottom' : 'reach-top')
}
if (Math.abs(fixedY - thumbY) > this.props.distance) {
this._fireReachEnd(fixedY > thumbY ? 'reach-bottom' : 'reach-top')
} }
} }
} }
@ -330,12 +327,10 @@ export default class Scroll {
fixedX = fixedX >> 0 fixedX = fixedX >> 0
if (fixedX === thumbX) { if (fixedX !== thumbX) {
return this.state.thumbX = fixedX
this.__X__.style.transform = `translateX(${fixedX}px)`
} }
this.state.thumbX = fixedX
this.__X__.style.transform = `translateX(${fixedX}px)`
} }
} }