增加本地坐标系的判断
This commit is contained in:
parent
13f1ea0ec6
commit
cd34006635
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user