blob: 731cb1bdeb6ce0a9d66fa17f1f887f70f8eb9558 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
export const normalizeWheelDelta = (input: { deltaY: number; deltaMode: number; rootHeight: number }) => {
if (input.deltaMode === 1) return input.deltaY * 40
if (input.deltaMode === 2) return input.deltaY * input.rootHeight
return input.deltaY
}
export const shouldMarkBoundaryGesture = (input: {
delta: number
scrollTop: number
scrollHeight: number
clientHeight: number
}) => {
const max = input.scrollHeight - input.clientHeight
if (max <= 1) return true
if (!input.delta) return false
if (input.delta < 0) return input.scrollTop + input.delta <= 0
const remaining = max - input.scrollTop
return input.delta > remaining
}
|