增加本地坐标系的判断

This commit is contained in:
anlicheng 2025-02-24 23:34:32 +08:00
parent 13f1ea0ec6
commit cd34006635

View File

@ -264,10 +264,12 @@ struct IndexView: View {
.background(GeometryReader {
geometry in
Color.clear.onChange(of: geometry.frame(in: .global).minY) {_, offset in
let frame = geometry.frame(in: .global)
let screenBounds = UIScreen.main.bounds
if screenBounds.height - frame.minY > 50 && !isMoreLoading {
let contextFrame = geometry.frame(in: .named("scrollView"))
if screenBounds.height - frame.minY > 50 && contextFrame.minY > 0 && !isMoreLoading {
Task {
self.isMoreLoading = true
await self.indexModel.loadMoreUpdateDramas(userId: 1, mode: .next)
@ -281,6 +283,7 @@ struct IndexView: View {
ProgressView()
}
}
.coordinateSpace(name: "scrollView")
.popover(isPresented: $showDateNavPopover) {
DateNavView(selectGroupId: self.$selectGroupId, showDateNavPopover: $showDateNavPopover) { selectedDate in
print("new selected date: " + selectedDate)
@ -328,15 +331,6 @@ struct IndexView: View {
extension IndexView {
// PreferenceKey
struct ScrollOffsetKey: PreferenceKey {
static var defaultValue: CGFloat = 0
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value = nextValue()
}
}
//
struct DramaCellView: View {
let dramaItem: IndexModel.DramaItem