Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Jul 21, 2024
1 parent a7c0fc7 commit d21c05c
Showing 1 changed file with 72 additions and 72 deletions.
144 changes: 72 additions & 72 deletions Sources/SwiftUISnapDraggingModifier/CustomGesture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct CustomGesture: UIGestureRecognizerRepresentable {
return false
}
}

// switch configuration.scrollViewOption.scrollViewDetection {
// case .noTracking:
// return false
Expand Down Expand Up @@ -121,7 +121,7 @@ struct CustomGesture: UIGestureRecognizerRepresentable {
context.coordinator.tracking.beganPoint = context.converter.location(
in: coordinateSpaceInDragging
)

fallthrough
case .changed:

Expand Down Expand Up @@ -170,27 +170,35 @@ struct CustomGesture: UIGestureRecognizerRepresentable {
}
}

// if panDirection.contains(.left) {
//
// if scrollableEdges.contains(.right) == false {
// scrollController.lockScrolling(direction: .horizontal)
// _onChange(value)
// } else {
//
// }
//
// }
//
// if panDirection.contains(.right) {
//
// if scrollableEdges.contains(.left) == false {
// scrollController.lockScrolling(direction: .horizontal)
// _onChange(value)
// } else {
//
// }
//
// }
if panDirection.contains(.left) {

if scrollableEdges.contains(.right) == false {
scrollController.lockScrolling(direction: .horizontal)
if context.coordinator.tracking.trackingLocation == .zero {
context.coordinator.tracking.trackingLocation = value.location
}
context.coordinator.tracking.isDragging = true
_onChange(value.fixingLocation(context.coordinator.tracking.trackingLocation))
} else {

}

}

if panDirection.contains(.right) {

if scrollableEdges.contains(.left) == false {
scrollController.lockScrolling(direction: .horizontal)
if context.coordinator.tracking.trackingLocation == .zero {
context.coordinator.tracking.trackingLocation = value.location
}
context.coordinator.tracking.isDragging = true
_onChange(value.fixingLocation(context.coordinator.tracking.trackingLocation))
} else {

}

}

} else {
context.coordinator.tracking.isDragging = true
Expand Down Expand Up @@ -507,59 +515,51 @@ extension UIScrollView {

ScrollView([.horizontal, .vertical]) {
Grid {
GridRow {
ForEach(0..<8) { _ in Color.primary.frame(width: 20, height: 20) }
}
GridRow {
ForEach(0..<8) { _ in Color.primary.frame(width: 20, height: 20) }
}
GridRow {
ForEach(0..<8) { _ in Color.primary.frame(width: 20, height: 20) }
}
GridRow {
ForEach(0..<8) { _ in Color.primary.frame(width: 20, height: 20) }
}
GridRow {
ForEach(0..<8) { _ in Color.primary.frame(width: 20, height: 20) }
}
}
}

ScrollView {
VStack {
ForEach(0..<20) { index in
HStack {
Spacer()
Button("Button") {

}
.tint(.primary)
Spacer()
ForEach(0..<8) { _ in
GridRow {
ForEach(0..<8) { _ in Color.teal.frame(width: 30, height: 30) }
}
.padding(2)
}
}
.padding()
.background(Color.red)
}
.contentMargins(10)
.background(Color.yellow.tertiary)

ScrollView(.horizontal) {
HStack {
ForEach(0..<5) { index in
HStack {
Spacer()
Button("Button") {

}
.tint(.primary)
Spacer()
}
.padding(4)
.padding(.vertical, 10)
}
}
}
.background(Color.yellow.tertiary)

// ScrollView {
// VStack {
// ForEach(0..<20) { index in
// HStack {
// Spacer()
// Button("Button") {
//
// }
// .tint(.primary)
// Spacer()
// }
// .padding(2)
// }
// }
// }
// .contentMargins(10)
// .background(Color.yellow.tertiary)
//
// ScrollView(.horizontal) {
// HStack {
// ForEach(0..<5) { index in
// HStack {
// Spacer()
// Button("Button") {
//
// }
// .tint(.primary)
// Spacer()
// }
// .padding(4)
// .padding(.vertical, 10)
// }
// }
// }
// .background(Color.yellow.tertiary)
}
.frame(width: 200, height: 200)
.background(Color.green.secondary)
Expand Down

0 comments on commit d21c05c

Please sign in to comment.