Posts

Post not yet marked as solved
1 Replies
877 Views
I recognized that it is not possible to build a view where the user can simultaneously interact with one subview's gesture modifier and also another view's standard touch behaviour (for instance Slider, Stepper or TextField) while it is however possible to interact with two sliders at once or apply a gesture to a slider which will result in all gesture handlers being fired.The little view below shows an image that is draggable and next to it two sliders.✅ Both sliders can be used at the same time.✅ It is also possible to start dragging the slider and then start dragging the the image.❌ It is however not possible to start dragging the image and then interact with the Sliders in any way.✅ It is possible to add a gestures to the sliders that will be called, but then I would need to reimplement all the logic that the sliders already have.struct ContentView: View { @State var v1: Double = 0.5 @State var v2: Double = 0.5 @State var draggedOffset = CGSize.zero var body: some View { HStack() { Image(systemName: "ellipsis.circle.fill") .font(Font.system(size: 32)) .padding(32) .offset(self.draggedOffset) .gesture( DragGesture(minimumDistance: 12.0, coordinateSpace: .global) .onChanged { value in self.draggedOffset = value.translation } .onEnded { value in self.draggedOffset = .zero } ) VStack() { Slider(value: $v1) Slider(value: $v2) } } } }Is there some sort of method that needs to be called so that the touches will be passed through to the sliders?
Posted
by Enie.
Last updated
.