iOS: Fix toolbars disappearing when scrolling too far up

This commit is contained in:
Shadowfacts 2020-09-29 15:29:58 -04:00
parent 012ada4af7
commit 1449dc215b
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 11 additions and 6 deletions

View File

@ -49,11 +49,16 @@ struct ContentView: View {
// It's not actually user scrolling, and this screws up our animation, so we ignore it. // It's not actually user scrolling, and this screws up our animation, so we ignore it.
guard abs(delta) != outer.safeAreaInsets.top else { return } guard abs(delta) != outer.safeAreaInsets.top else { return }
if delta != 0 { if scrollOffset < 0 {
barOffset += delta barOffset = 0
} else {
if delta != 0 {
barOffset += delta
}
print(barOffset)
barOffset = max(0, min(navBarHeight + outer.safeAreaInsets.top, barOffset))
} }
barOffset = max(0, min(navBarHeight + outer.safeAreaInsets.top, barOffset))
} }
} }
@ -63,7 +68,7 @@ struct ContentView: View {
Color.clear.preference(key: NavBarHeightPrefKey.self, value: geom.frame(in: .global).height) Color.clear.preference(key: NavBarHeightPrefKey.self, value: geom.frame(in: .global).height)
}) })
.offset(y: -barOffset) .offset(y: -barOffset)
Spacer() Spacer()
ToolBar(navigator: navigator, shareCurrentURL: shareCurrentURL) ToolBar(navigator: navigator, shareCurrentURL: shareCurrentURL)

View File

@ -59,7 +59,7 @@
<EnvironmentVariable <EnvironmentVariable
key = "DEFAULT_URL" key = "DEFAULT_URL"
value = "gemini://drewdevault.com" value = "gemini://drewdevault.com"
isEnabled = "YES"> isEnabled = "NO">
</EnvironmentVariable> </EnvironmentVariable>
</EnvironmentVariables> </EnvironmentVariables>
</LaunchAction> </LaunchAction>