fix: correct home mask threshold after early scroll
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
/**
|
||||
* Convert a viewport-relative header bottom into a document-relative mask
|
||||
* threshold. Selector queries report coordinates relative to the current
|
||||
* viewport, so the scroll offset at measurement time must be added back.
|
||||
*/
|
||||
export function getTopMaskStartY({ viewportBottom, scrollTop, statusBarHeight }) {
|
||||
const safeViewportBottom = Number.isFinite(viewportBottom) ? viewportBottom : 0
|
||||
const safeScrollTop = Number.isFinite(scrollTop) ? scrollTop : 0
|
||||
const safeStatusBarHeight = Number.isFinite(statusBarHeight) ? statusBarHeight : 0
|
||||
|
||||
return Math.max(0, safeViewportBottom + safeScrollTop - safeStatusBarHeight - 8)
|
||||
}
|
||||
|
||||
export function getTopMaskProgress({ scrollTop, startY, rangeY }) {
|
||||
const safeScrollTop = Number.isFinite(scrollTop) ? scrollTop : 0
|
||||
const start = Math.max(0, Number.isFinite(startY) ? startY : 0)
|
||||
|
||||
Reference in New Issue
Block a user