mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 04:27:26 +08:00
fix(components): fix virtual list scroll&wheel handler (#11472)
fix xEndEdge&yEndEdge logic when wheel event emits fix hasReachedEdge logic when offsetX offsetY is zero closed #11463, #11155 Co-authored-by: 迦叶(仝航) <jiaye@xiaohongshu.com>
This commit is contained in:
@ -326,11 +326,15 @@ const createGrid = ({
|
||||
{
|
||||
atXStartEdge: computed(() => states.value.scrollLeft <= 0),
|
||||
atXEndEdge: computed(
|
||||
() => states.value.scrollLeft >= estimatedTotalWidth.value
|
||||
() =>
|
||||
states.value.scrollLeft >=
|
||||
estimatedTotalWidth.value - unref(parsedWidth)
|
||||
),
|
||||
atYStartEdge: computed(() => states.value.scrollTop <= 0),
|
||||
atYEndEdge: computed(
|
||||
() => states.value.scrollTop >= estimatedTotalHeight.value
|
||||
() =>
|
||||
states.value.scrollTop >=
|
||||
estimatedTotalHeight.value - unref(parsedHeight)
|
||||
),
|
||||
},
|
||||
(x: number, y: number) => {
|
||||
|
@ -21,9 +21,9 @@ export const useGridWheel = (
|
||||
|
||||
const hasReachedEdge = (x: number, y: number) => {
|
||||
const xEdgeReached =
|
||||
(x < 0 && atXStartEdge.value) || (x > 0 && atXEndEdge.value)
|
||||
(x <= 0 && atXStartEdge.value) || (x >= 0 && atXEndEdge.value)
|
||||
const yEdgeReached =
|
||||
(y < 0 && atYStartEdge.value) || (y > 0 && atYEndEdge.value)
|
||||
(y <= 0 && atYStartEdge.value) || (y >= 0 && atYEndEdge.value)
|
||||
return xEdgeReached && yEdgeReached
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user