mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-02 23:51:34 +00:00
fix(ios): reduce back-to-latest button sensitivity
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/// Presentation-only hysteresis. Being close enough to hide the latest
|
||||
/// button never opts the reader back into tail following.
|
||||
struct TranscriptBottomProximity {
|
||||
private(set) var isAwayFromBottom = false
|
||||
|
||||
mutating func update(bottomDistance: Double, followsTail: Bool) {
|
||||
guard !followsTail else {
|
||||
isAwayFromBottom = false
|
||||
return
|
||||
}
|
||||
let distance = max(0, bottomDistance)
|
||||
if isAwayFromBottom {
|
||||
if distance <= 24 { isAwayFromBottom = false }
|
||||
} else if distance >= 80 {
|
||||
isAwayFromBottom = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user