Skip to content

Commit

Permalink
Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Jul 20, 2024
1 parent a6efbc4 commit 3ed760e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/FluidGroup/swiftui-support", from: "0.4.0"),
.package(url: "https://github.com/FluidGroup/swiftui-support", from: "0.9.0"),
.package(url: "https://github.com/FluidGroup/swift-rubber-banding", from: "1.0.0")
],
targets: [
Expand Down
12 changes: 10 additions & 2 deletions Sources/SwiftUISnapDraggingModifier/SnapDraggingModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,17 @@ public struct SnapDraggingModifier: ViewModifier {
self.onEnded(velocity: .zero)
}
}

let addingGesture = dragGesture.simultaneously(with: gesture)

Group {
switch gestureMode {
case .normal:
base
.gesture(dragGesture.simultaneously(with: gesture), including: .all)
.gesture(addingGesture, including: .all)
case .highPriority:
base
.highPriorityGesture(dragGesture, including: .all)
.highPriorityGesture(addingGesture, including: .all)
}
}
.animatableOffset(x: currentOffset.width, y: currentOffset.height)
Expand Down Expand Up @@ -407,8 +409,14 @@ struct VelocityDraggingModifier_Previews: PreviewProvider {
.frame(width: 120, height: 50)
.modifier(
SnapDraggingModifier(
<<<<<<< Updated upstream
axis: [.vertical],
verticalBoundary: .init(min: -10, max: 10, bandLength: 50)
=======
offset: $offset,
springParameter: .interpolation(mass: 1, stiffness: 1, damping: 1),
gestureMode: .highPriority
>>>>>>> Stashed changes
)
)

Expand Down

0 comments on commit 3ed760e

Please sign in to comment.