chore: refactoring and tests, splitting up files (#12495)
This commit is contained in:
@@ -0,0 +1,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
|
||||
}
|
||||
Reference in New Issue
Block a user